conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Show me all customers whose last name starts with 'M' and who were created in the system after July 1, 2022." }, { "role": "assistant", "content": "SELECT customer_id, first_name, last_name, email, created_at\nFROM insurance.customers\nWHERE last_name LIKE 'M%' 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 insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "Which token has the highest net USD value difference between buys and sells? Show token_symbol, chain, narrative, average buy price, average sell price, and the net difference." }, { "role": "assistant", "content": "WITH buys AS (\n SELECT token_address, token_symb...
You are an SQL statement expert. Given the table 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...
[ { "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": "List each client's first_name, last_name and the sum of total_amount from invoices where status is either 'Sent' or 'Paid'." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, SUM(i.total_amount) AS total_amount_sum\nFROM legal_services.clients ...
You are an SQL statement expert. Given the table 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": "Get the list of all active insurance products along with the number of policies sold under each product and the average premium amount." }, { "role": "assistant", "content": "SELECT ip.product_id, ip.product_name, COUNT(p.policy_id) AS policy_count, AVG(p.premium_am...
You are an SQL statement expert. Given the table 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 transactions where the sender and receiver addresses are the same. List transaction_id, amount, and timestamp." }, { "role": "assistant", "content": "SELECT transaction_id, amount, timestamp FROM blockchain.transactions WHERE sender_address = receiver_addres...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction ...
[ { "role": "user", "content": "List all post IDs that have more than one hashtag associated with them." }, { "role": "assistant", "content": "SELECT post_id FROM social_media.post_hashtags GROUP BY post_id HAVING COUNT(hashtag_id) > 1;" }, { "role": "user", "content": "For each of the...
You are an SQL statement expert. Given the table 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.post_hashtags ( post_hashtag_id.text, post_id.text, hashtag_id.text )
[ { "role": "user", "content": "List all claims along with the first and last names of the agent who is currently handling each claim." }, { "role": "assistant", "content": "SELECT c.claim_id, c.policy_id, c.incident_date, a.first_name AS agent_first_name, a.last_name AS agent_last_name\nFROM insu...
You are an SQL statement expert. Given the table 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, -- unique identifier for the claim policy_id charac...
[ { "role": "user", "content": "Which customers have more than one active policy at the same time? Show the customer ID and the number of active policies." }, { "role": "assistant", "content": "SELECT customer_id, COUNT(policy_id) AS active_policy_count\nFROM insurance.policies\nWHERE status = 'Ac...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "Can you show me all diagnoses with code_type 'ICD-9' that were made in 2022, including diagnosis_id, patient_id, diagnosis_code, and diagnosis_date?" }, { "role": "assistant", "content": "SELECT diagnosis_id, patient_id, diagnosis_code, diagnosis_date FROM healthcar...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry ...
[ { "role": "user", "content": "Show me all unique bed types available across different properties along with their base rates." }, { "role": "assistant", "content": "SELECT DISTINCT bed_type, base_rate, property_id FROM hospitality_technology.room_types;" }, { "role": "user", "content...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu...
[ { "role": "user", "content": "List all metadata entries showing the metadata_id, asset_id, key, and value." }, { "role": "assistant", "content": "SELECT metadata_id, asset_id, key, value FROM metadata" } ]
You are an SQL statement expert. Given the table 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": "List all invoices issued between '2024-01-01' and '2024-06-30', including the invoice_number, issue_date, total_amount, client's first and last name, and the case_name. Order the results by issue_date ascending." }, { "role": "assistant", "content": "SELECT i.invoic...
You are an SQL statement expert. Given the table 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": "For each reservation, list reservation_id, guest_id, check_in_date, and the next reservation_id and check_in_date for the same guest." }, { "role": "assistant", "content": "SELECT r1.reservation_id AS current_reservation_id, r1.guest_id, r1.check_in_date AS current_...
You are an SQL statement expert. Given the table 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 text, property_id text, guest_id text, room_id text, room_type_id ...
[ { "role": "user", "content": "List all peers who were last seen after July 10, 2024, along with their IP address and port." }, { "role": "assistant", "content": "SELECT peer_id, ip_address, port, last_seen\nFROM trading_platform.peers\nWHERE last_seen > '2024-07-10'\nORDER BY last_seen 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 character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "What is the total USD value held by all centralized exchanges (CEX) for the token with the symbol 'BTC'?" }, { "role": "assistant", "content": "SELECT SUM(usd_value) AS total_btc_cex_value FROM cex_token_balance WHERE token_symbol = 'BTC';" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Retrieve the daily total fare collected for bookings with status 'Completed' in March 2024. Display the booking_date and total_fare." }, { "role": "assistant", "content": "SELECT\n DATE(booking_time) AS booking_date,\n 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.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Show me every medication manufactured by 'Teva', including the medication ID and the name." }, { "role": "assistant", "content": "SELECT medication_id, medication_name\nFROM healthcare.medications\nWHERE manufacturer = 'Teva';" } ]
You are an SQL statement expert. Given the table 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": "Could you provide the sum of Deposit and Withdrawal amounts for each customer, showing their first and last names?" }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name,\n SUM(CASE WHEN t.transaction_type = 'Deposit' THEN t.amo...
You are an SQL statement expert. Given the table 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": "Can you list all the room types and their base rates along with the maximum occupancy for each property?" }, { "role": "assistant", "content": "SELECT property_id, type_name, base_rate, max_occupancy FROM hospitality_technology.room_types;" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ...
[ { "role": "user", "content": "Count the number of assets for each asset type." }, { "role": "assistant", "content": "SELECT type, COUNT(*) FROM trading_platform.assets GROUP BY 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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "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 routes that have a distance greater than 100 km, showing the route number, origin and destination location IDs." }, { "role": "assistant", "content": "SELECT route_number, origin_location_id, destination_location_id FROM transportation.routes WHERE distance...
You are an SQL statement expert. Given the table 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": "List all fuel logs including the timestamp, fuel type, quantity, and total cost." }, { "role": "assistant", "content": "SELECT log_timestamp, fuel_type, quantity, total_cost FROM transportation.fuel_logs;" }, { "role": "user", "content": "Add the vehicle...
You are an SQL statement expert. Given the table 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": "List the patient ID, first name, last name, and phone number for all patients whose emergency contact name or phone number is missing." }, { "role": "assistant", "content": "SELECT patient_id, first_name, last_name, phone_number FROM healthcare.patients WHERE emerge...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "For each product type, count how many of the products are currently active." }, { "role": "assistant", "content": "SELECT product_type, COUNT(*) FROM insurance.insurance_products WHERE is_active = TRUE GROUP BY product_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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Show me all medical report documents with their claim IDs and descriptions, sorted by upload date." }, { "role": "assistant", "content": "SELECT document_id, claim_id, description, uploaded_at FROM insurance.claim_documents WHERE document_type = 'medical_report' ORD...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text, claim_id text, document_type text, file_name text, file_path text, file_s...
[ { "role": "user", "content": "List pairs of citizens who share the same email domain." }, { "role": "assistant", "content": "SELECT c1.first_name AS first1,\n c1.last_name AS last1,\n c2.first_name AS first2,\n c2.last_name AS last2,\n SPLIT_PART(c1.contact_email, '@', 2)...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens where the price is greater than $0.10." }, { "role": "assistant", "content": "SELECT tm.name, tm.contract_address, tm.total_supply 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 token_metas ( block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded ...
[ { "role": "user", "content": "Can you list each employee's first and last name along with the first and last name of their manager?" }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, m.first_name AS manager_first_name, m.last_name AS manager_last_name\nFROM 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.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, depa...
[ { "role": "user", "content": "List all pairs of lawyers from the same firm who were hired in the same month and year. Include each lawyer's first_name, last_name, firm_id, and the shared hire_month_year." }, { "role": "assistant", "content": "SELECT a.first_name AS lawyer1_first_name,\n 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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "How many applications are currently pending review? Please group the results by assigned_employee_id." }, { "role": "assistant", "content": "SELECT assigned_employee_id, COUNT(*) AS pending_applications FROM government_services.applications WHERE status = 'Pending' ...
You are an SQL statement expert. Given the table 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.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, statu...
[ { "role": "user", "content": "Which tokens have a current price above $20 and belong to the 'DeFi' narrative?" }, { "role": "assistant", "content": "SELECT token_symbol, token_name, chain, price\nFROM token_basic_info\nWHERE price > 20 AND narrative = 'DeFi';" }, { "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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "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 where the price is greater than $0.1." }, { "role": "assistant", "content": "SELECT tm.name, tm.contract_address, tm.total_supply, tp...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Give me the number of achievements unlocked each day, returning unlock_date and unlock_count." }, { "role": "assistant", "content": "SELECT date_trunc('day', unlocked_at)::date AS unlock_date,\n COUNT(*) AS unlock_count\nFROM gaming_technology.player_achieveme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N...
[ { "role": "user", "content": "List all posts created by user 'U100' in March 2024." }, { "role": "assistant", "content": "SELECT post_id, user_id, content, created_at FROM social_media.posts WHERE user_id = 'U100' AND created_at >= '2024-03-01' AND created_at < '2024-04-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 social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u...
[ { "role": "user", "content": "List the NDC code and description for any medication that has an NDC code starting with '5'." }, { "role": "assistant", "content": "SELECT ndc_code, description FROM healthcare.medications WHERE ndc_code LIKE '5%';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,...
[ { "role": "user", "content": "Show each player's username along with the number of unique games they've played, and also include the total number of sessions for each player." }, { "role": "assistant", "content": "SELECT p.player_id, p.username, COUNT(DISTINCT gs.game_id) AS unique_games_played,...
You are an SQL statement expert. Given the table 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": "List the ERC20 tokens (from token_metas) with exactly 6 decimals. Show their symbol, contract_address, and name." }, { "role": "assistant", "content": "SELECT symbol, contract_address, name FROM token_metas WHERE is_erc20 = 1 AND decimals = 6;" }, { "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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Show all users whose full name starts with 'A' and who have updated their profile in June 2024. Please include their usernames and updated_at timestamps." }, { "role": "assistant", "content": "SELECT username, updated_at FROM social_media.users WHERE full_name 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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Get the number of documents for each case, showing case_id and document count, ordered by count descending." }, { "role": "assistant", "content": "SELECT case_id,\n COUNT(*) AS document_count\nFROM legal_services.documents\nGROUP BY case_id\nORDER BY document_...
You are an SQL statement expert. Given the table 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 the content and comment ID for all comments made by users with private profiles." }, { "role": "assistant", "content": "SELECT c.comment_id, c.content FROM social_media.comments AS c JOIN social_media.user_settings AS us ON c.user_id = us.user_id WHERE us.priva...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "List all inactive customers from California, showing their full names and the date they were created." }, { "role": "assistant", "content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'California' AND status = 'Inactive';" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer first_...
[ { "role": "user", "content": "Find the average score for each player who has participated in game sessions." }, { "role": "assistant", "content": "SELECT player_id, AVG(score) AS avg_score\nFROM gaming_technology.game_sessions\nGROUP BY player_id;" }, { "role": "user", "content": "No...
You are an SQL statement expert. Given the table 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": "Find pairs of patients where patient A's emergency contact phone matches patient B's phone number, and patient B's emergency contact phone matches patient A's phone number. Include both patient IDs, their full names, patient A's phone, and patient B's phone." }, { "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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List the full names and dates of birth for all patients who do not have a phone number on record." }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE phone_number IS NULL OR TRIM(phone_number) = '';" } ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me all transactions (transaction_id, amount, transaction_type) where the transaction_type is 'Transfer' and the status is 'Completed', along with the account_id and related_account_id." }, { "role": "assistant", "content": "SELECT transaction_id, amount, transa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the trans...
[ { "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 the top 10 token transfers by value, including the token ID and the transaction ID, sorted in descending order." }, { "role": "assistant", "content": "SELECT token_id, transaction_id, value FROM web3.token_transfers ORDER BY value DESC LIMIT 10;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ...
[ { "role": "user", "content": "Show total session duration and average score for each player across all their sessions. Display the player ID, total duration, and average score." }, { "role": "assistant", "content": "SELECT player_id, SUM(duration_seconds) AS total_duration, AVG(score) AS average...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date...
[ { "role": "user", "content": "List each hashtag's tag_name alongside the next tag_name alphabetically." }, { "role": "assistant", "content": "SELECT h1.tag_name AS current_tag, (\n SELECT MIN(tag_name)\n FROM social_media.hashtags\n WHERE tag_name > h1.tag_name\n) AS next_tag\nFROM social_med...
You are an SQL statement expert. Given the table 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.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre...
[ { "role": "user", "content": "List pairs of drivers where one driver was hired before another and both have the same status. Display the earlier driver's first_name as earlier_name and hire_date as earlier_hire_date, and the later driver's first_name as later_name and hire_date as later_hire_date, along wit...
You are an SQL statement expert. Given the table 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 each loan with its loan_id, principal_amount, interest_rate, origination_date, and show the ticker_symbol and security_name of any collateral, matching on collateral_description = ticker_symbol from the securities table." }, { "role": "assistant", "content": "S...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "List the make, model, and acquisition_date for vehicles acquired after January 1, 2022." }, { "role": "assistant", "content": "SELECT make, model, acquisition_date\nFROM transportation.vehicles\nWHERE acquisition_date > '2022-01-01';" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "List the usernames and emails of users who have set a location in their profile." }, { "role": "assistant", "content": "SELECT username, email\nFROM social_media.users\nWHERE location IS NOT NULL AND location != '';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "List each recipient_user_id and the count of unread notifications they have, but only include users with public profiles." }, { "role": "assistant", "content": "SELECT n.recipient_user_id, COUNT(*) AS unread_count\nFROM social_media.notifications n\nJOIN social_medi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u...
[ { "role": "user", "content": "Show me all transactions along with the related account IDs where the transaction type is 'Transfer'." }, { "role": "assistant", "content": "SELECT transaction_id, account_id, related_account_id, transaction_type, amount, currency, transaction_date, status FROM fina...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id text PRIMARY KEY, account_id text, related_account_id text, transactio...
[ { "role": "user", "content": "List the last 20 messages that have a media_url, showing message_id, sender_user_id, media_type, and sent_at, ordered by sent_at descending." }, { "role": "assistant", "content": "SELECT message_id,\n sender_user_id,\n media_type,\n sent_at\nFROM 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 social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message convers...
[ { "role": "user", "content": "Show me all cancelled policies along with their product details and the reason for cancellation." }, { "role": "assistant", "content": "SELECT p.*, ip.product_name, ip.product_type, p.cancellation_reason FROM insurance.policies p JOIN insurance.insurance_products ip...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "List the customer ID, first_name, last_name, city, and the number of active policies each customer has, but only include customers who live in 'CA' and have at least 2 active policies." }, { "role": "assistant", "content": "SELECT cu.customer_id, cu.first_name, cu.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 insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "Show me the total quantity of each item each player currently has in their inventory." }, { "role": "assistant", "content": "SELECT player_id, item_id, SUM(quantity) AS total_quantity FROM gaming_technology.player_inventory GROUP BY player_id, item_id" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id uuid PRIMARY KEY, game_id uuid, server_name text, region text, ip_address text, p...
[ { "role": "user", "content": "For each asset, I want to know how many orders have the status 'filled', showing the asset symbol." }, { "role": "assistant", "content": "SELECT m.value AS asset_symbol,\n COUNT(*) AS filled_order_count\nFROM trading_platform.orders o\nJOIN trading_platform.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 trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Show me all transactions sent by wallet addresses that have a private key starting with '0x1', along with the receiver address and amount." }, { "role": "assistant", "content": "SELECT t.transaction_id, t.receiver_address, t.amount FROM blockchain.transactions t JOI...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri...
[ { "role": "user", "content": "Could you provide a count of servers for each geographical region?" }, { "role": "assistant", "content": "SELECT region, COUNT(*) FROM gaming_technology.servers GROUP BY region;" }, { "role": "user", "content": "Now, filter this list to only include regi...
You are an SQL statement expert. Given the table 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": "Show a list of cases, displaying the case number, the case name, and the law firm associated with the case's lead attorney, specifically when the lead attorney is the firm's managing partner." }, { "role": "assistant", "content": "SELECT T1.case_number, T1.case_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.law_firms ( firm_id text PRIMARY KEY, firm_name text, address text, phone text, website text, founded_da...
[ { "role": "user", "content": "Find the user ID with the most wallets and list their user ID and the total number of wallets they have." }, { "role": "assistant", "content": "SELECT user_id, COUNT(wallet_id) AS wallet_count FROM web3.wallets GROUP BY user_id ORDER BY wallet_count DESC LIMIT 1;" ...
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.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(6...
[ { "role": "user", "content": "List each user’s user_id and username along with their total trading value (sum of quantity * price from trades) as a buyer for trades executed in June 2024. Show the top 5 users by total value descending." }, { "role": "assistant", "content": "SELECT u.user_id, 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 character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "I want to find the total number of transactions and the total amount sent by each sender address, including the sender's current balance." }, { "role": "assistant", "content": "SELECT t.sender_address, COUNT(*) AS transaction_count, SUM(t.amount) AS total_amount, 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 blockchain.transactions ( transaction_id.text, block_id.text, sender_address.text, receiver_address.text, amount.numeri...
[ { "role": "user", "content": "Find all pairs of payments for the same policy where the payment_periods overlap. Show payment_id1, payment_id2, policy_id, overlap_start, and overlap_end." }, { "role": "assistant", "content": "SELECT p1.payment_id AS payment_id1,\n p2.payment_id AS payment_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id.text, policy_id.text, customer_id.text, payment_date.timestamp, amount_paid.num...
[ { "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 all male patients who have an email address but no emergency contact listed, along with their full names and phone numbers." }, { "role": "assistant", "content": "SELECT CONCAT(first_name, ' ', last_name) AS full_name, phone_number FROM healthcare.patients 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List all peers that haven't been active for more than 7 days, along with their IP addresses and ports." }, { "role": "assistant", "content": "SELECT peer_id, ip_address, port FROM trading_platform.peers WHERE last_seen < NOW() - INTERVAL '7 days';" }, { "rol...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta...
[ { "role": "user", "content": "Find all assets that have metadata with both 'category' and 'subcategory' keys, along with their corresponding values." }, { "role": "assistant", "content": "SELECT m1.asset_id, m1.value as category, m2.value as subcategory FROM trading_platform.metadata m1 JOIN 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.metadata ( metadata_id character varying(64) NOT NULL, -- unique identifier for the metadata ...
[ { "role": "user", "content": "Calculate the average 24-hour trading volume for all tokens listed in DEX pools on the 'BSC' chain." }, { "role": "assistant", "content": "SELECT AVG(volume_24h) FROM token_dexpool_info WHERE chain = 'BSC'" } ]
You are an SQL statement expert. Given the table 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 the full names of guests who have made reservations at properties with a star rating of 5. Include the guest ID and the property name." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.guest_id, T3.property_name FROM hospitality_tech...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "For each policy, find the latest payment date. Show the policy_id and the maximum payment_date." }, { "role": "assistant", "content": "SELECT policy_id, MAX(payment_date) AS latest_payment_date FROM insurance.premium_payments GROUP BY policy_id;" }, { "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.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo...
[ { "role": "user", "content": "Show me all locations in California that are of type 'gas station', including their name, city, and postal code." }, { "role": "assistant", "content": "SELECT name, city, postal_code FROM transportation.locations WHERE state_province = 'California' AND type = 'gas 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 transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, ...
[ { "role": "user", "content": "For each agent, show the total number of policies they have sold and the sum of the premium amounts. Include the agent_id." }, { "role": "assistant", "content": "SELECT agent_id, COUNT(*) AS policy_count, SUM(premium_amount) AS total_premium\nFROM insurance.policies...
You are an SQL statement expert. Given the table 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, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "List all appointments scheduled in the next 7 days along with the appointment_id, appointment_time, patient's full name, doctor's full name, and the patient's primary insurance plan_name." }, { "role": "assistant", "content": "SELECT ap.appointment_id,\n ap.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 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 appointments booked online in April 2024. List their ID, scheduled start time, and purpose." }, { "role": "assistant", "content": "SELECT appointment_id, scheduled_start_time, purpose FROM government_services.appointments WHERE booking_method = 'Online' ...
You are an SQL statement expert. Given the table 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.appointments ( appointment_id character varying(64) NOT NULL, citizen_id character varying(64) NOT ...
[ { "role": "user", "content": "List all unread notifications for group conversations, including the conversation name, sender_user_id, and notification creation time." }, { "role": "assistant", "content": "SELECT c.group_name, n.sender_user_id, n.created_at\nFROM social_media.notifications n\nJOI...
You are an SQL statement expert. Given the table 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.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text ) CREATE TABLE social_media.conversati...
[ { "role": "user", "content": "Show the policy_id, policy_number, and premium_amount for all policies with a coverage_limit less than 100,000." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, premium_amount\nFROM insurance.policies\nWHERE coverage_limit < 100000;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "List all premium payments that were made using 'credit card' as the payment method." }, { "role": "assistant", "content": "SELECT payment_id, policy_id, customer_id, payment_date, amount_paid, payment_method\nFROM insurance.premium_payments\nWHERE payment_method = '...
You are an SQL statement expert. Given the table 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, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "List each document_name along with the count of its versions, but only include those document_names that have more than 3 versions." }, { "role": "assistant", "content": "SELECT document_name,\n COUNT(version) AS version_count\nFROM legal_services.documents\nG...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "Show me all hashtags that were created in June 2024, and for each, display the hashtag ID, tag name, and when it was created." }, { "role": "assistant", "content": "SELECT hashtag_id, tag_name, created_at FROM social_media.hashtags WHERE created_at >= '2024-06-01' A...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, -- unique identifier for the hashtag tag_nam...
[ { "role": "user", "content": "Find all pairs of drivers who share the same status. Include both driver_ids, full names, and the shared status." }, { "role": "assistant", "content": "SELECT d1.driver_id AS driver1_id, d1.first_name || ' ' || d1.last_name AS driver1_name, d2.driver_id AS driver2_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 transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Show all employees who are managers (i.e., have direct reports). Display the employee's full name, department, and the number of employees they manage." }, { "role": "assistant", "content": "SELECT e.employee_id, e.first_name, e.last_name, e.department, COUNT(r.empl...
You are an SQL statement expert. Given the table 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 the average number of current players for each server region." }, { "role": "assistant", "content": "SELECT region, AVG(current_players) AS average_players FROM gaming_technology.servers GROUP BY region;" }, { "role": "user", "content": "Now, onl...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, game_id uuid, server_name text, region text, ip_address text, p...
[ { "role": "user", "content": "Show me all users who have made at least one comment and have their profiles set to private. I want their user IDs and the time their settings were last updated." }, { "role": "assistant", "content": "SELECT DISTINCT c.user_id, us.updated_at\nFROM social_media.comme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "List the usernames and full names of users who created their account in 2024 and are verified." }, { "role": "assistant", "content": "SELECT username, full_name FROM social_media.users WHERE created_at >= '2024-01-01' AND created_at < '2025-01-01' AND is_verified = ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "List all agents who have sold policies with a coverage limit above 500000. Show agent_id, first_name, last_name, and the count of such policies as policy_count." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name, a.last_name, COUNT(p.policy_id) A...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer first_...
[ { "role": "user", "content": "List the full name (first name and last name) of all citizens who have uploaded documents whose expiry date is in the past." }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name, T1.last_name FROM government_services.citizens AS T1 INNER JOIN governme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Find all pairs of securities that are issued by the same issuer but listed on different exchanges." }, { "role": "assistant", "content": "SELECT a.issuer_name, a.ticker_symbol AS symbol_a, a.exchange AS exchange_a, b.ticker_symbol AS symbol_b, b.exchange AS exchange...
You are an SQL statement expert. Given the table 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, ticker_symbol text, isin_code text, cusip_code text, security_name te...
[ { "role": "user", "content": "Find all documents that are larger than 5MB. Show the document ID, claim ID, file name, and file size in bytes." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name, file_size_bytes\nFROM insurance.claim_documents\nWHERE file_size_bytes > 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.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "How many unique patients have been diagnosed with code_type 'ICD-10'?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT patient_id) FROM healthcare.diagnoses WHERE code_type = 'ICD-10';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty...
[ { "role": "user", "content": "Find all medical records with a vital sign for temperature above 38°C. Show the record ID and record date." }, { "role": "assistant", "content": "SELECT record_id, record_date\nFROM healthcare.medical_records\nWHERE (vitals ->> 'temperature')::numeric > 38;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "List all trips with their ID, vehicle ID, and driver ID." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id FROM transportation.trips;" }, { "role": "user", "content": "Can you also include the scheduled departure and actual arr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati...
[ { "role": "user", "content": "For each security sector, what is the average volume recorded in the market data?" }, { "role": "assistant", "content": "SELECT T2.sector, AVG(T1.volume) FROM financial_services.market_data AS T1 JOIN financial_services.securities AS T2 ON T1.security_id = T2.securi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.market_data ( data_point_id bigserial NOT NULL, -- auto-incrementing primary key security_id...
[ { "role": "user", "content": "Show the first and last name of each citizen and the count of their scheduled appointments." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(a.appointment_id) AS scheduled_appointment_count FROM government_services.citizens AS c JOIN go...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "Find all bookings along with the first and last name of the passenger and the trip_id, where the booking status is 'Cancelled'." }, { "role": "assistant", "content": "SELECT b.booking_id, p.first_name, p.last_name, b.trip_id\nFROM transportation.bookings b\nJOIN 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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...