conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Show me all customers (customer_id, first_name, last_name) who live in California (state = 'CA') and have a risk_profile of 'High', along with their email addresses." }, { "role": "assistant", "content": "SELECT customer_id, first_name, last_name, email FROM financi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "List all invoices that do not have any associated documents for their case. Show the invoice number, total amount, and case_id." }, { "role": "assistant", "content": "SELECT i.invoice_number, i.total_amount, i.case_id\nFROM legal_services.invoices i\nLEFT JOIN legal...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "List all fuel logs for vehicle 'VHCL123', including the fuel type, quantity, and total cost." }, { "role": "assistant", "content": "SELECT fuel_log_id, fuel_type, quantity, total_cost FROM transportation.fuel_logs WHERE vehicle_id = 'VHCL123';" }, { "role": ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu...
[ { "role": "user", "content": "Find the fastest reply for each conversation, showing conversation_id, initial_message_id, reply_message_id, and response_time in seconds." }, { "role": "assistant", "content": "SELECT m1.conversation_id,\n m1.message_id AS initial_message_id,\n m2.messa...
You are an SQL statement expert. Given the table 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": "Find users who have never followed anyone but have created at least 5 posts. Return user_id and post_count." }, { "role": "assistant", "content": "SELECT u.user_id, COUNT(p.post_id) AS post_count\nFROM social_media.users u\nLEFT JOIN social_media.posts p ON u.user_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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Count how many users have not specified a value for their bio." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.users WHERE bio IS NULL OR bio = '';" } ]
You are an SQL statement expert. Given the table 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": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses." }, { "role": "assistant", "content": "SELECT name, contract_address, total_supply FROM token_metas WHERE is_erc20 = 1 ORDER BY CAST(total_supply AS decimal)...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "Show each player's ID and the number of different achievement IDs they have unlocked." }, { "role": "assistant", "content": "SELECT player_id, COUNT(DISTINCT achievement_id) AS achievement_count\nFROM gaming_technology.player_achievements\ngroup by player_id;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ...
[ { "role": "user", "content": "Get the total number of guests for each country_code." }, { "role": "assistant", "content": "SELECT country_code, COUNT(*) AS guest_count\nFROM hospitality_technology.guests\nGROUP BY country_code;" }, { "role": "user", "content": "Actually, only include...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "List the user IDs for users who have both private profiles enabled and push notifications enabled." }, { "role": "assistant", "content": "SELECT user_id FROM social_media.user_settings WHERE private_profile = TRUE AND push_notifications_enabled = TRUE;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.likes ( like_id text, user_id text, post_id text, comment_id text, created_at timestamp ) CREATE TABLE soc...
[ { "role": "user", "content": "Show me all active agents who have handled claims with police reports, along with the count of such claims per agent." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name, a.last_name, COUNT(c.claim_id) AS police_report_claim_count FROM insurance.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.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "I need a list of claim_ids that have at least one document of type 'Photo' and at least one of type 'Invoice'." }, { "role": "assistant", "content": "SELECT DISTINCT cd.claim_id\nFROM insurance.claim_documents cd\nWHERE cd.document_type IN ('Photo', 'Invoice');" }...
You are an SQL statement expert. Given the table 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 all appointments with their subject and associated case number for appointments that have both a case_id and a non-null location." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.subject, a.case_id, c.case_number\nFROM legal_services.appointmen...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the case/matter case_n...
[ { "role": "user", "content": "List all agencies that do not have a website URL specified. Return their agency_id, agency_name, and main_phone_number." }, { "role": "assistant", "content": "SELECT agency_id, agency_name, main_phone_number FROM government_services.agencies WHERE website_url IS NUL...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "Which citizens have had both applications and appointments for services in the 'Healthcare' category? List their full name, application ID, and appointment ID." }, { "role": "assistant", "content": "SELECT DISTINCT c.first_name || ' ' || c.last_name AS full_name, a....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "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": "List all premium payments along with the full name of the agent who sold each policy and the name of the related insurance product." }, { "role": "assistant", "content": "SELECT pp.payment_id, pp.amount_paid, pp.payment_date, a.first_name AS agent_first_name, a.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.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "For each medication, show the total number of prescriptions where at least one refill was allowed." }, { "role": "assistant", "content": "SELECT medication_id, COUNT(*) AS prescription_count FROM healthcare.prescriptions WHERE refills_allowed > 0 GROUP BY medication...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "List the user ID, username, and wallet address for all users who have at least one unspent UTXO associated with any of their wallets." }, { "role": "assistant", "content": "SELECT DISTINCT T1.user_id, T1.username, T2.address FROM trading_platform.users AS T1 JOIN tr...
You are an SQL statement expert. Given the table 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 coin types and symbols from the sui_coins_metadata table." }, { "role": "assistant", "content": "SELECT coin_type, symbol FROM sui_coins_metadata;" }, { "role": "user", "content": "Only show coins with status 'exists'." }, { "role": "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 nft_holders ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.text, amoun...
[ { "role": "user", "content": "List all premium payments made by Bank Transfer where the amount_paid is greater than 5000. Show payment_id, policy_id, customer_id, amount_paid, and payment_date, ordered by amount_paid descending." }, { "role": "assistant", "content": "SELECT payment_id,\n p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "Show the latest version number of each document_name for every case." }, { "role": "assistant", "content": "SELECT case_id,\n document_name,\n MAX(version) AS latest_version\nFROM legal_services.documents\nGROUP BY case_id, document_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.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "List the contract ID, address, and deployer address for all contracts deployed on the 'mainnet' network." }, { "role": "assistant", "content": "SELECT contract_id, address, deployer_address FROM web3.contracts WHERE network_id = 'mainnet';" } ]
You are an SQL statement expert. Given the table 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": "What is the total number of likes recorded in the system?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.likes;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
[ { "role": "user", "content": "Show me the post ID, content, and creation time for all posts made by user 'user789'." }, { "role": "assistant", "content": "SELECT post_id, content, created_at FROM social_media.posts WHERE user_id = 'user789';" }, { "role": "user", "content": "Modify t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi...
[ { "role": "user", "content": "Show the count of services available for each category." }, { "role": "assistant", "content": "SELECT category, COUNT(service_id) AS service_count FROM government_services.services GROUP BY category;" }, { "role": "user", "content": "Only include categor...
You are an SQL statement expert. Given the table 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 how many achievements each player has unlocked." }, { "role": "assistant", "content": "SELECT player_id,\n COUNT(*) AS total_unlocked\nFROM gaming_technology.player_achievements\nGROUP BY player_id;" }, { "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.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N...
[ { "role": "user", "content": "What is the average investment value for projects that completed Series A funding rounds?" }, { "role": "assistant", "content": "SELECT AVG(investment_value) AS average_investment FROM project_fundraising_record WHERE rounds_name = 'Series A';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Find all pairs of products that share the same product_type but have differing active statuses, listing both their product_ids, product_types, and is_active flags." }, { "role": "assistant", "content": "SELECT p1.product_id AS product_id_1,\n p1.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 PRIMARY KEY, product_name text, product_type text, description text, bas...
[ { "role": "user", "content": "List the document ID, file name, and size for all documents uploaded in the last 30 days by user 'agent_smith' that are larger than 5 megabytes, ordered by upload time descending." }, { "role": "assistant", "content": "SELECT document_id, file_name, file_size_bytes ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ...
[ { "role": "user", "content": "Can you list all assets along with their names and types, but only show assets whose symbol contains the letter 'A'?" }, { "role": "assistant", "content": "SELECT asset_id, name, symbol, type FROM trading_platform.assets WHERE symbol LIKE '%A%';" }, { "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 trading_platform.assets ( asset_id text PRIMARY KEY, name text, symbol text, type text )
[ { "role": "user", "content": "Find all review comments that have a staff response, showing the comment and the staff response date." }, { "role": "assistant", "content": "SELECT comment, response_date FROM reviews WHERE response_date IS NOT NULL;" }, { "role": "user", "content": "Now...
You are an SQL statement expert. Given the table 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.reviews ( review_id text PRIMARY KEY, property_id text, reservation_id text, guest_id text, rati...
[ { "role": "user", "content": "Can you show me the document types submitted by citizens whose accounts are verified, and for each, the email of the citizen who uploaded it?" }, { "role": "assistant", "content": "SELECT d.document_type, c.contact_email\nFROM government_services.documents d\nJOIN g...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "role": "user", "content": "Find patients who currently have both a primary and a secondary insurance policy. For each, show patient_id, full name, primary policy_number, and secondary policy_number." }, { "role": "assistant", "content": "SELECT p.patient_id,\n p.first_name || ' ' || p.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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List all users and the total quantity of orders they have placed for 'buy' orders." }, { "role": "assistant", "content": "SELECT t1.username, SUM(t2.quantity) FROM trading_platform.users AS t1 JOIN trading_platform.orders AS t2 ON t1.user_id = t2.user_id WHERE t2.or...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text...
[ { "role": "user", "content": "How many games are available on each platform?" }, { "role": "assistant", "content": "SELECT platform,\n COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY platform;" }, { "role": "user", "content": "Only include platforms that have mor...
You are an SQL statement expert. Given the table 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": "For each review, show me the review comment and the associated service names that the guest has ordered during the same reservation." }, { "role": "assistant", "content": "SELECT r.review_id, r.comment, s.service_name \nFROM hospitality_technology.reviews r\nJOIN ho...
You are an SQL statement expert. Given the table 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": "How many tokens had a net positive flow according to smart_money_token_performance, and what is their average ROI?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS token_count, AVG(roi) AS avg_roi\nFROM smart_money_token_performance\nWHERE net_flow > 0;" ...
You are an SQL statement expert. Given the table 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, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "List all notifications related to messages. Please show notification_id, recipient_user_id, conversation_id, and the creation time." }, { "role": "assistant", "content": "SELECT notification_id, recipient_user_id, target_entity_id AS conversation_id, created_at\nFRO...
You are an SQL statement expert. Given the table 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": "Find posts that have been liked by users the author of the post is following. List the post_id and the user_id of the post author." }, { "role": "assistant", "content": "SELECT p.post_id, p.user_id AS post_author_user_id FROM social_media.posts AS p JOIN 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 character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi...
[ { "role": "user", "content": "Show me all room types with their property IDs and amenities where the description includes 'ocean view'." }, { "role": "assistant", "content": "SELECT room_type_id, property_id, amenities FROM hospitality_technology.room_types WHERE description LIKE '%ocean view%';...
You are an SQL statement expert. Given the table 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, property_id character varying(64) NOT ...
[ { "role": "user", "content": "List all claim documents of type 'POLICE_REPORT' uploaded in June 2024. Show document_id, claim_id, and file_name." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name\nFROM insurance.claim_documents\nWHERE document_type = 'POLICE_REPORT'\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.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d...
[ { "role": "user", "content": "Provide a list of all unique genders present in the citizens table." }, { "role": "assistant", "content": "SELECT DISTINCT gender FROM government_services.citizens;" }, { "role": "user", "content": "How many citizens belong to each gender?" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "List all staff members, the property name they work for, and the number of services offered at their property." }, { "role": "assistant", "content": "SELECT s.staff_id, s.first_name, s.last_name, p.property_name, COUNT(sv.service_id) AS service_count\nFROM hospitali...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Can you fetch all claims reported in the past 30 days, including claim_id, incident_date, reported_date, and estimated_loss?" }, { "role": "assistant", "content": "SELECT claim_id, incident_date, reported_date, estimated_loss\nFROM insurance.claims\nWHERE reported_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 insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "List each username with how many users they follow and how many users follow them." }, { "role": "assistant", "content": "SELECT u.username,\n COALESCE(following.following_count, 0) AS following_count,\n COALESCE(followers.followers_count, 0) AS follower...
You are an SQL statement expert. Given the table 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": "Show the total fare collected from bookings, grouped by the state/province of the destination location of the trip, for bookings made in May 2024." }, { "role": "assistant", "content": "SELECT\n l.state_province,\n SUM(b.fare) AS total_fare_collected\nFROM transpo...
You are an SQL statement expert. Given the table 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": "Find all users who have wallets but have never logged any actions, along with their wallet creation date." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, w.created_at AS wallet_created_at FROM trading_platform.users u JOIN trading_platform.wallets ...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "Show all achievements for games developed in Germany, including achievement names and their point values." }, { "role": "assistant", "content": "SELECT a.name AS achievement_name, a.points\nFROM gaming_technology.achievements a\nJOIN gaming_technology.games g ON a.g...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ...
[ { "role": "user", "content": "How many conversations are group chats?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.conversations WHERE is_group_chat = TRUE;" } ]
You are an SQL statement expert. Given the table 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": "What is the total USD value of tokens held by Binance exchange on the Ethereum chain according to the cex_token_balance table?" }, { "role": "assistant", "content": "SELECT SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE exchange = 'Binance' AND chain...
You are an SQL statement expert. Given the table 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 text, token_name text, token_symbol text, chain text, price numeric, price_change_per...
[ { "role": "user", "content": "Show me a list of appointments, including their subject and start time, along with the case number for the related case." }, { "role": "assistant", "content": "SELECT T1.subject, T1.start_time, T2.case_number FROM appointments AS T1 JOIN cases AS T2 ON T1.case_id = ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Show the wallet ID, user's username, and the creator address for all wallets whose address was used to deploy a smart contract." }, { "role": "assistant", "content": "SELECT w.wallet_id, u.username, sc.creator_address\nFROM blockchain.wallets w\nJOIN blockchain.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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text...
[ { "role": "user", "content": "Show me all items of rarity 'Epic', displaying the item's name and type, along with the title of the game it is part of." }, { "role": "assistant", "content": "SELECT igi.item_name, igi.item_type, g.title FROM gaming_technology.in_game_items igi JOIN gaming_technolo...
You are an SQL statement expert. Given the table 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_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for...
[ { "role": "user", "content": "List the first name and last name of the driver and the license plate of the vehicle used for each trip." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , T3.license_plate FROM transportation.drivers AS T1 JOIN transportation.trips AS T2 O...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "How many services are defined for each service category?" }, { "role": "assistant", "content": "SELECT category, COUNT(*) AS service_count FROM government_services.services GROUP BY category;" }, { "role": "user", "content": "Only show categories that ha...
You are an SQL statement expert. Given the table 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 a summary of customers with their total account balance and the count of accounts." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(a.account_id) AS account_count, SUM(a.balance) AS total_account_balance FROM financial_services....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "Which smart money address on the 'Ethereum' chain has the highest profit from tokens in the 'DeFi' narrative, and what is their ROI?" }, { "role": "assistant", "content": "SELECT sm.address, sm.profit, sm.roi\nFROM smart_money_profit sm\nJOIN smart_money_token_inflo...
You are an SQL statement expert. Given the table 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 character varying(512) NOT NULL, -- the id of narrative", "top_3_coins text, --...
[ { "role": "user", "content": "For each property, count the total number of rooms and the total number of available services." }, { "role": "assistant", "content": "SELECT r.property_id,\n COUNT(DISTINCT r.room_id) AS room_count,\n COUNT(DISTINCT s.service_id) FILTER (WHERE s.is_avail...
You are an SQL statement expert. Given the table 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": "List all projects that have completed a Series A funding round, including their investment value and valuation." }, { "role": "assistant", "content": "SELECT project_name, investment_value, valuation FROM project_fundraising_record WHERE rounds_name = 'Series A';" ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "Show the number of employees in each department." }, { "role": "assistant", "content": "SELECT department, COUNT(*) AS employee_count\nFROM financial_services.employees\ngroup BY department;" }, { "role": "user", "content": "Exclude departments that have...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "Show me the usernames of users who have commented on posts that were created in group chat conversations, along with the names of those group chats." }, { "role": "assistant", "content": "SELECT u.username, c.group_name\nFROM social_media.comments cm\nJOIN 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.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "Show me the total transaction amount sent by each user (based on user_id) in the last 30 days, along with their username." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, SUM(t.amount) AS total_amount FROM blockchain.users u JOIN blockchain.walle...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic...
[ { "role": "user", "content": "Show all users who follow both user 'U100' and user 'U101'." }, { "role": "assistant", "content": "SELECT f1.follower_user_id\nFROM social_media.follows f1\nJOIN social_media.follows f2 ON f1.follower_user_id = f2.follower_user_id\nWHERE f1.following_user_id = 'U100...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ...
[ { "role": "user", "content": "Show me the full names and specialties of all doctors who have issued a prescription for a patient enrolled in an insurance plan provided by 'Global Health'." }, { "role": "assistant", "content": "SELECT DISTINCT d.first_name, d.last_name, d.specialty\nFROM healthca...
You are an SQL statement expert. Given the table 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 each chronic active diagnosis along with the prescribed medication details, showing diagnosis_id, diagnosis_code, medication_id, dosage, and diagnosis_date." }, { "role": "assistant", "content": "SELECT d.diagnosis_id, d.diagnosis_code, p.medication_id, p.dosag...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "For each wallet, show the wallet address and the total value of tokens they have received across all token transfers." }, { "role": "assistant", "content": "SELECT w.address, COALESCE(SUM(tt.value), 0) AS total_received_value\nFROM web3.wallets w\nLEFT JOIN web3.tok...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id text, contract_id text, event_name text, data text, emitted_at timestamp, transaction_id text, l...
[ { "role": "user", "content": "Show all items where the attributes JSON has a non-null 'defense' value. Display item_id, item_name, rarity, and the defense value." }, { "role": "assistant", "content": "SELECT item_id, item_name, rarity, (attributes->>'defense')::numeric AS defense FROM gaming_tec...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.in_game_items ( item_id uuid PRIMARY KEY, game_id uuid, item_name text, item_type text, description t...
[ { "role": "user", "content": "Show me all active vehicles with their make, model, and license plate, along with their depot_id." }, { "role": "assistant", "content": "SELECT make, model, license_plate, depot_id FROM transportation.vehicles WHERE status = 'active';" }, { "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 text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Find all users along with another user who shares their email domain." }, { "role": "assistant", "content": "SELECT u1.user_id, u1.username, u2.user_id AS other_user_id, u2.username AS other_username\nFROM web3.users u1\nJOIN web3.users u2 ON split_part(u1.email, '@...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username character vary...
[ { "role": "user", "content": "Show me all wallet addresses that hold more than 100 of any ERC1155 token, along with the token ID and amount." }, { "role": "assistant", "content": "SELECT wallet_address, token_id, amount FROM erc20_balances WHERE CAST(amount AS decimal) > 100 AND contract_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "List each passenger's first_name, last_name along with another passenger's first_name and last_name who share the same loyalty_program_id. Label them as member and peer." }, { "role": "assistant", "content": "SELECT p1.first_name AS member_first, p1.last_name AS mem...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.passengers ( passenger_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "What is the average ROI for smart money addresses on the Ethereum chain with a realized ratio above 70%?" }, { "role": "assistant", "content": "SELECT AVG(roi) FROM smart_money_profit WHERE chain = 'Ethereum' AND realized_ratio > 70;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO...
[ { "role": "user", "content": "For each trip, show the trip ID, scheduled departure, and the last name of the driver." }, { "role": "assistant", "content": "SELECT t.trip_id, t.scheduled_departure, d.last_name\nFROM transportation.trips t\nJOIN transportation.drivers d ON t.driver_id = d.driver_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": "Find all pairs of lawyers who were hired on the exact same date but have different specializations. Return each lawyer's name, hire_date, and both specializations." }, { "role": "assistant", "content": "SELECT a.lawyer_id AS lawyer1_id,\n a.first_name AS la...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "Show me all medical records along with the date and the name of the doctor who created them." }, { "role": "assistant", "content": "SELECT mr.record_id, mr.record_date, d.first_name || ' ' || d.last_name AS doctor_full_name\nFROM healthcare.medical_records mr\nJOIN ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "I need to get the most recent message each verified user has sent in any group chat, showing username, group_name, message_id, and sent_at." }, { "role": "assistant", "content": "WITH user_recent AS (\n SELECT m.sender_user_id, m.message_id, m.conversation_id, m.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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Show me all loans with a term longer than 36 months, including their loan_id, account_id, and principal_amount." }, { "role": "assistant", "content": "SELECT loan_id, account_id, principal_amount FROM financial_services.loans WHERE term_months > 36;" }, { "r...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b...
[ { "role": "user", "content": "Provide a count of servers per game status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS server_count FROM gaming_technology.servers GROUP BY status;" }, { "role": "user", "content": "Filter the list to only show statuses that have 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 gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, server_id.uuid, start_time.timestamptz...
[ { "role": "user", "content": "Show the contract address, token name, and total supply for all tokens, along with the deployer address of the contract where each token was created." }, { "role": "assistant", "content": "SELECT t.contract_address, t.token_name, t.total_supply, c.deployer_address\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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "I need to find all pairs of policies for each customer whose coverage periods overlap. Show customer_id, the two policy_ids for each overlapping pair." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_id,\n p2.policy...
You are an SQL statement expert. Given the table 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": "How many patients have at least one medical record associated with them?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT patient_id) FROM healthcare.medical_records;" }, { "role": "user", "content": "Now, can you show me the count of patient...
You are an SQL statement expert. Given the table 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 claim documents for claims with an estimated loss greater than $50,000, including the claim ID, document_id, document type, and file name." }, { "role": "assistant", "content": "SELECT cd.claim_id, cd.document_id, cd.document_type, cd.file_name\nFROM insura...
You are an SQL statement expert. Given the table 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": "Find all vehicles that share the same make and model but were manufactured in different years. Show both vehicle IDs, the make, model, and their respective years." }, { "role": "assistant", "content": "SELECT v1.vehicle_id AS vehicle1_id,\n v2.vehicle_id AS ve...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "I want to see the total sum of transaction amounts and their average amount for each transaction_type along with the total number of transactions, grouped by currency." }, { "role": "assistant", "content": "SELECT transaction_type, currency, COUNT(*) AS total_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 text, account_id text, related_account_id text, transaction_type text,...
[ { "role": "user", "content": "List all narratives that have a market cap between 500,000,000 and 5,000,000,000 USD and a positive price change over the last 7 days. Show the narrative name, market cap, and price change percentage for the last 7 days." }, { "role": "assistant", "content": "SELECT...
You are an SQL statement expert. Given the table 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": "I need to find pairs of players who share the same email domain. For each pair, return player1_id, player2_id, and the shared domain." }, { "role": "assistant", "content": "SELECT p1.player_id AS player1_id,\n p2.player_id AS player2_id,\n LOWER(SPLIT_PA...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "List all users and the count of wallets they own." }, { "role": "assistant", "content": "SELECT u.username, COUNT(w.wallet_id) AS wallet_count FROM blockchain.users u JOIN blockchain.wallets w ON u.user_id = w.user_id GROUP BY u.user_id, u.username;" }, { "r...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.addresses ( address_id character varying(128) NOT NULL, public_key text N...
[ { "role": "user", "content": "List the total number of 'login' and 'logout' actions per user." }, { "role": "assistant", "content": "SELECT user_id, SUM(CASE WHEN action = 'login' THEN 1 ELSE 0 END) AS login_count, SUM(CASE WHEN action = 'logout' THEN 1 ELSE 0 END) AS logout_count FROM trading_p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
[ { "role": "user", "content": "List the count of events for each contract deployed by address '0x123abc...'" }, { "role": "assistant", "content": "SELECT c.address, COUNT(e.event_id) FROM web3.contracts c JOIN web3.events e ON c.contract_id = e.contract_id WHERE c.deployer_address = '0x123abc...'...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi...
[ { "role": "user", "content": "Show me all comments that have non-empty content, including their ID, post ID, user ID, and content." }, { "role": "assistant", "content": "SELECT comment_id, post_id, user_id, content FROM social_media.comments WHERE content IS NOT NULL AND 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 social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ...
[ { "role": "user", "content": "Show me the wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount, from the erc20_balances table." }, { "role": "assistant", "content": "SELECT e.wallet_address, t.symbol, e.amount FROM erc20_balances e JOIN token_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 erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ...
[ { "role": "user", "content": "List all servers hosting games that have more than 50 achievements. Show server name, region, and the total achievement count for the game." }, { "role": "assistant", "content": "SELECT s.server_name, s.region, COUNT(a.achievement_id) AS total_achievements FROM gami...
You are an SQL statement expert. Given the table 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 me the total premium amount paid by each customer, grouped by customer_id and payment_method." }, { "role": "assistant", "content": "SELECT customer_id, payment_method, SUM(amount_paid) AS total_paid\nFROM insurance.premium_payments\nGROUP BY customer_id, payme...
You are an SQL statement expert. Given the table 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": "For each service, show the service name and the total number of applications submitted for it." }, { "role": "assistant", "content": "SELECT s.service_name, COUNT(a.application_id) AS total_applications\nFROM government_services.services s\nLEFT JOIN government_serv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "List all trades for a given security, showing ticker_symbol, trade_id, account_id, trade_type, and total_amount." }, { "role": "assistant", "content": "SELECT s.ticker_symbol, t.trade_id, t.account_id, t.trade_type, t.total_amount\nFROM financial_services.trades t\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 text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Find the top 3 achievements with the highest points. Return achievement_id, name, and points." }, { "role": "assistant", "content": "SELECT achievement_id,\n name,\n points\nFROM gaming_technology.achievements\nORDER BY points DESC\nLIMIT 3;" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show each asset's symbol and the number of unique addresses that have UTXOs associated with it." }, { "role": "assistant", "content": "SELECT a.symbol, COUNT(DISTINCT u.address) AS unique_addresses\nFROM trading_platform.assets a\nJOIN trading_platform.utxos u ON 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 trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Show me all accounts (account_id, account_number, balance) that have a balance greater than $50,000 and are in USD currency, along with the security details (ticker_symbol, security_name) for securities traded on the same exchange as the account's last_updated_at 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": "List the full names of employees whose direct manager themselves report to another manager. Also show the direct manager's full name." }, { "role": "assistant", "content": "SELECT E.first_name, E.last_name, M.first_name AS manager_first_name, M.last_name AS manager_...
You are an SQL statement expert. Given the table 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...