conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "For each block_number, compute the maximum and minimum gas_used." }, { "role": "assistant", "content": "SELECT block_number,\n MAX(gas_used) AS max_gas_used,\n MIN(gas_used) AS min_gas_used\nFROM transactions\nGROUP BY block_number;" }, { "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 web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price...
[ { "role": "user", "content": "For each lawyer, show their first name, last name, and the total number of documents they have uploaded, along with the names of the law firms they belong to." }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, f.firm_name, COUNT(d.document_id) ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Retrieve the first and last names and email addresses of all customers who registered after '2024-01-01'." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM insurance.customers WHERE created_at > '2024-01-01';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin...
[ { "role": "user", "content": "Show me all trades for account 'ACC654321' executed after January 1, 2024." }, { "role": "assistant", "content": "SELECT *\nFROM financial_services.trades\nWHERE account_id = 'ACC654321' AND trade_timestamp > '2024-01-01';" }, { "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 financial_services.trades ( trade_id character varying(64) NOT NULL, -- unique identifier for the trade account...
[ { "role": "user", "content": "Find all users who have deployed contracts, along with their email addresses and the count of contracts they've deployed, sorted by contract count in descending order." }, { "role": "assistant", "content": "SELECT u.username, u.email, COUNT(c.contract_id) AS contrac...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "What is the total transaction amount for each transaction_type in the last 30 days?" }, { "role": "assistant", "content": "SELECT transaction_type, SUM(amount) AS total_amount FROM financial_services.transactions WHERE transaction_date >= CURRENT_DATE - INTERVAL '30...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ...
[ { "role": "user", "content": "Show all routes including their number, type, and description." }, { "role": "assistant", "content": "SELECT route_number , type , description FROM transportation.routes" }, { "role": "user", "content": "Only show routes of type 'City Bus'." }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Which users have posted content in the same location (latitude and longitude) on the same day? Show their usernames, post_ids, and the posting date." }, { "role": "assistant", "content": "SELECT u1.username AS username1, u2.username AS username2, p1.post_id AS post_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Show me all wallet addresses and their private keys for users who have more than 3 wallets." }, { "role": "assistant", "content": "SELECT w.address_id, w.private_key FROM blockchain.wallets w WHERE w.user_id IN (SELECT user_id FROM blockchain.wallets GROUP BY 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 blockchain.wallets ( wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet user_id cha...
[ { "role": "user", "content": "Find all top-level agencies that do not have a parent agency. Display their agency_id and agency_name." }, { "role": "assistant", "content": "SELECT agency_id, agency_name\nFROM government_services.agencies\nWHERE parent_agency_id IS NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List the first name, last name, email, and phone number of all clients who have a case of type 'Bankruptcy', along with the name of the case." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , T1.email , T1.phone , T2.case_name FROM leg...
You are an SQL statement expert. Given the table 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": "I want to retrieve all claims with an estimated loss greater than 10000, including the claim ID, incident date, beneficiary first and last name, and relationship." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, b.first_name, b.last_name, b...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "List all staff members showing their full name and position." }, { "role": "assistant", "content": "SELECT first_name || ' ' || last_name AS staff_full_name, position FROM hospitality_technology.staff;" }, { "role": "user", "content": "Now only include 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 hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat...
[ { "role": "user", "content": "Show all payments along with the guest's first and last name, and the staff member who processed each payment. Include payment_id, amount, currency_code, payment_timestamp, guest first_name, guest last_name, staff first_name, and staff last_name." }, { "role": "assistan...
You are an SQL statement expert. Given the table 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": "What is the average ROI for all smart money addresses on the Binance chain?" }, { "role": "assistant", "content": "SELECT AVG(roi) FROM smart_money_profit WHERE chain = 'Binance';" } ]
You are an SQL statement expert. Given the table 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_profit ( address character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres...
[ { "role": "user", "content": "List the names of employees and the names of the cities where their agency operates service locations." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, sl.city\nFROM government_services.employees e\nJOIN government_services.service_locations ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List all users who have participated in group conversations created in April 2024, showing their username, conversation ID, and the group name." }, { "role": "assistant", "content": "SELECT DISTINCT u.username, c.conversation_id, c.group_name\nFROM social_media.conv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "For each booking, show the booking ID, the passenger ID, the trip ID, and indicate if a special request was made." }, { "role": "assistant", "content": "SELECT booking_id, passenger_id, trip_id, \n CASE WHEN special_requests IS NOT NULL AND special_requests <>...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, -- unique identifier for the booking pass...
[ { "role": "user", "content": "Which doctors have issued prescriptions with a route of 'Oral'? Please show doctor_id and the number of such prescriptions they have written." }, { "role": "assistant", "content": "SELECT doctor_id, COUNT(*) AS oral_prescription_count\nFROM healthcare.prescriptions\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, -- unique identifier for the prescriptio...
[ { "role": "user", "content": "Show the number of policies sold by each agent, including the agent's first and last name, specifically for policies related to 'auto' products." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, count(T2.policy_id) FROM insurance.agents AS 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 insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "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": "For each vehicle, show the fuel_log_id and log_timestamp for its earliest and latest fuel log entries by comparing timestamps." }, { "role": "assistant", "content": "SELECT fl_min.vehicle_id,\n fl_min.fuel_log_id AS earliest_log_id,\n fl_min.log_timestam...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu...
[ { "role": "user", "content": "Show me the usernames and email addresses of users who created their accounts in the last 7 days, ordered by creation date." }, { "role": "assistant", "content": "SELECT username, email FROM web3.users WHERE created_at >= NOW() - INTERVAL '7 days' ORDER BY created_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 web3.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
[ { "role": "user", "content": "Show me the user ID, wallet address, and transaction ID for the first 20 transactions sent from any user's wallet." }, { "role": "assistant", "content": "SELECT W.user_id, W.address, T.transaction_id FROM web3.wallets W JOIN web3.transactions T ON W.address = T.from...
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.transactions ( transaction_id text PRIMARY KEY, from_address text, to_address t...
[ { "role": "user", "content": "Show all rooms that are on floor 3." }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;" }, { "role": "user", "content": "For these rooms, include the property name and room n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Can you provide a summary of how many securities exist for each combination of exchange and sector?" }, { "role": "assistant", "content": "SELECT exchange, sector, COUNT(*) AS total_count\nFROM financial_services.securities\nGROUP BY exchange, sector;" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu...
[ { "role": "user", "content": "Can you show me the number of unique doctors by specialty who were created after January 1st, 2024?" }, { "role": "assistant", "content": "SELECT specialty, COUNT(DISTINCT doctor_id) AS doctor_count\nFROM healthcare.doctors\nWHERE created_at > '2024-01-01'\nGROUP BY...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ...
[ { "role": "user", "content": "Show me all invoices, displaying their invoice number and the payment date, for invoices that have been fully paid." }, { "role": "assistant", "content": "SELECT invoice_number, payment_date FROM legal_services.invoices WHERE status = 'Paid';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice invo...
[ { "role": "user", "content": "Find all managing partners who oversee more than one firm at the same address. Show the managing partner ID, the shared address, and the number of firms they manage at that address." }, { "role": "assistant", "content": "SELECT managing_partner_id, address, COUNT(*)...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t...
[ { "role": "user", "content": "Show me claim_id, incident_date, policy_number, and customer full name for all claims where settlement_amount is null." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, p.policy_number, cu.first_name || ' ' || cu.last_name AS customer_full_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.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "Provide the total number of room types and the average base_rate for each property that has a star_rating of at least 4.0." }, { "role": "assistant", "content": "SELECT p.property_id,\n p.property_name,\n COUNT(rt.room_type_id) AS room_type_count,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "For each agency offering more than 5 active services, list the agency_name, jurisdiction_level, and the count of active services. Order the results by the count in descending order." }, { "role": "assistant", "content": "SELECT a.agency_name,\n a.jurisdiction_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Retrieve the top 5 tokens by 24h price_change_percentage_24h from token_basic_info along with their chain, narrative, and total 24h trading volume. Also include the narrative's token count from narrative_info." }, { "role": "assistant", "content": "SELECT t.token_sy...
You are an SQL statement expert. Given the table 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": "List pairs of drivers whose license expiry dates fall within 30 days of each other. Show both driver_ids, names, and the two expiry dates." }, { "role": "assistant", "content": "SELECT d1.driver_id AS driver1_id, d1.first_name AS driver1_first, d1.last_name AS drive...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "List all 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": "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": "List all premium payments along with the email of the customer and the document_id of any claim documents related to claims made on the same policy." }, { "role": "assistant", "content": "SELECT pp.payment_id, pp.amount_paid, pp.payment_date, c.email, cd.document_id...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "Show me the top 5 NFT collections on Ethereum with the highest number of unique owners, along with their names and floor prices." }, { "role": "assistant", "content": "SELECT nc.name, nc.floor_price, COUNT(DISTINCT nh.wallet_address) AS unique_owners FROM nft_collec...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "What is the average difficulty of blocks mined after January 1, 2023?" }, { "role": "assistant", "content": "SELECT AVG(difficulty) FROM blockchain.blocks WHERE timestamp > '2023-01-01 00:00:00';" }, { "role": "user", "content": "Can you also show the co...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, -- unique identifier for the block previous_block...
[ { "role": "user", "content": "Show me the count of law firms grouped by the year they were founded. Include the founding year and the number of firms." }, { "role": "assistant", "content": "SELECT\n EXTRACT(YEAR FROM founded_date) AS founding_year,\n COUNT(firm_id) AS firm_count\nFROM legal_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 legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t...
[ { "role": "user", "content": "How many players are there for each status in the players table?" }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS player_count\nFROM gaming_technology.players\nGROUP BY status;" }, { "role": "user", "content": "Exclude any rows where sta...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "List each patient's first and last name along with their total number of appointments in 2024." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, COUNT(a.appointment_id) AS appointment_count\nFROM healthcare.patients p\nLEFT JOIN healthcare.app...
You are an SQL statement expert. Given the table 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": "Count the total number of followers each user has, showing following_user_id as user_id and follower_count, for those users with more than 100 followers." }, { "role": "assistant", "content": "SELECT following_user_id AS user_id, COUNT(*) AS follower_count\nFROM soc...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "Show me all available non-smoking rooms on floors 3 or higher, along with their room numbers and features, ordered by floor number." }, { "role": "assistant", "content": "SELECT room_number, floor, features FROM hospitality_technology.rooms WHERE status = 'available...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i...
[ { "role": "user", "content": "Show me the top 5 users who have the highest total trade volume (quantity * price) as buyers, along with the number of distinct assets they traded." }, { "role": "assistant", "content": "SELECT t.buyer_id, u.email, SUM(t.quantity * t.price) AS total_volume, COUNT(DI...
You are an SQL statement expert. Given the table 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 passengers who have made bookings with special requests, along with their contact information and the count of such bookings." }, { "role": "assistant", "content": "SELECT p.passenger_id, p.first_name, p.last_name, p.email, p.phone_number, COUNT(b.bookin...
You are an SQL statement expert. Given the table 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 items with rarity = 'Legendary', showing item_id, item_name, and cost_amount." }, { "role": "assistant", "content": "SELECT item_id,\n item_name,\n cost_amount\nFROM gaming_technology.in_game_items\nWHERE rarity = 'Legendary';" }, { "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 gaming_technology.in_game_items ( item_id.uuid, game_id.uuid, item_name.text, item_type.text, description.text, rarity....
[ { "role": "user", "content": "List all pairs of lawyers with the same specialization." }, { "role": "assistant", "content": "SELECT l1.lawyer_id AS lawyer1_id,\n l1.first_name AS lawyer1_first_name,\n l1.last_name AS lawyer1_last_name,\n l2.lawyer_id AS lawyer2_id,\n l2.f...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "Count the number of customers grouped by their status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM insurance.customers GROUP BY status;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer first_...
[ { "role": "user", "content": "List all maintenance logs for vehicles that had 'Oil Change' service in the last 3 months, showing vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_typ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, -- unique identifier for the route route_numb...
[ { "role": "user", "content": "Find, for each case, pairs of documents where one document_type is 'Contract' and the other is 'Evidence'. Return the case_id, the name of the contract document as contract_name, and the name of the evidence document as evidence_name." }, { "role": "assistant", "con...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "List all drivers whose contact number is missing." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name FROM transportation.drivers WHERE contact_number IS NULL OR contact_number = '';" }, { "role": "user", "content": "Also inclu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "List all tokens with a liquidity over $1 million and a positive 1-hour price change percentage on the Ethereum chain." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, price, price_change_percentage_1h FROM token_dexpool_info WHERE chain = 'Eth...
You are an SQL statement expert. Given the table 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": "List all ERC20 token contract addresses with more than 200 approval events recorded in the erc20_approval table." }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) as approval_count FROM erc20_approval GROUP BY contract_address HAVING COUNT(*) ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Find tokens that are currently trending (trend rank 10 or lower) and have a positive net flow from smart money addresses. Show their token symbol, chain, trend rank, and smart money net flow. Order the results by trend rank ascending." }, { "role": "assistant", "con...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO...
[ { "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": "Which projects had fundraising rounds in the first quarter of 2022, and what were their investment values and round names?" }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, investment_date FROM project_fundraising_record WHER...
You are an SQL statement expert. Given the table 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 ch...
[ { "role": "user", "content": "List all policy beneficiaries who have a percentage share greater than 50%, along with their policy details." }, { "role": "assistant", "content": "SELECT pb.beneficiary_id, pb.policy_id, pb.customer_id, pb.first_name, pb.last_name, pb.relationship, pb.percentage_sh...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l...
[ { "role": "user", "content": "Show the count of citizens grouped by their verification status." }, { "role": "assistant", "content": "SELECT is_verified, COUNT(*) FROM government_services.citizens GROUP BY is_verified;" }, { "role": "user", "content": "Now, only include citizens who ...
You are an SQL statement expert. Given the table 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": "For each payment status, how many payments were made and what was the total amount paid? Order the results by the total amount paid in descending order." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS payment_count, SUM(amount_paid) AS total_amount...
You are an SQL statement expert. Given the table 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": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their token symbol and narrative." }, { "role": "assistant", "content": "SELECT token_symbol, narrative, usd_value FROM smart_money_token_inflow WHERE type = 1 ORDER BY ...
You are an SQL statement expert. Given the table 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 ch...
[ { "role": "user", "content": "What is the average commission_rate for each agent status and only show statuses with an average commission_rate above 0.05?" }, { "role": "assistant", "content": "SELECT status,\n AVG(commission_rate) AS avg_commission_rate\nFROM insurance.agents\nGROUP BY st...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "List all prescriptions where the dosage text contains the word 'unit'. Show the prescription ID, medication ID, and dosage." }, { "role": "assistant", "content": "SELECT prescription_id, medication_id, dosage FROM healthcare.prescriptions WHERE dosage LIKE '%unit%';...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, record_id text, patient_id text, doctor_id text, diagnosis_code t...
[ { "role": "user", "content": "How many appointments are recorded in the system?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM appointments;" }, { "role": "user", "content": "Show the count of appointments for each status." }, { "role": "assistant", "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 government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "Can you help me retrieve the details of all platforms at a specific station with station_id 'STATION_001', including the platform status and whether they are accessible?" }, { "role": "assistant", "content": "SELECT platform_id, platform_number, track_number, status...
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 train_station_management.platforms ( platform_id character varying(64) NOT NULL,...
[ { "role": "user", "content": "Find employees who were hired after their managers. Display the employee's full name, their hire date, the manager's full name, and the manager's hire date." }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.last_name AS employee_name, e.hire_dat...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the government...
[ { "role": "user", "content": "I want to see, for each security, the total number of market data points and the average adjusted_close_price, including ticker_symbol and security_name." }, { "role": "assistant", "content": "SELECT s.ticker_symbol, s.security_name, COUNT(md.data_point_id) AS data_...
You are an SQL statement expert. Given the table 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": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address, from the nft_holders table." }, { "role": "assistant", "content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "Show me the highest and lowest close price for each security in the 'Healthcare' sector, along with the security name." }, { "role": "assistant", "content": "SELECT s.security_name, MAX(md.close_price) AS highest_close, MIN(md.close_price) AS lowest_close\nFROM 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.securities ( security_id character varying(64) NOT NULL, -- unique identifier for the security ...
[ { "role": "user", "content": "Can you show me the total number of items acquired by each player, along with the title of each game and the player's ID?" }, { "role": "assistant", "content": "SELECT pi.player_id, g.title AS game_title, SUM(pi.quantity) AS total_items_acquired\nFROM gaming_technol...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, devel...
[ { "role": "user", "content": "Show me all terminated staff members along with their termination dates and the names of their managers, ordered by termination date." }, { "role": "assistant", "content": "SELECT s1.staff_id, s1.first_name, s1.last_name, s1.termination_date, s2.first_name AS manage...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir...
[ { "role": "user", "content": "List each case_number along with the total number of documents associated with it." }, { "role": "assistant", "content": "SELECT c.case_number,\n COUNT(d.document_id) AS document_count\nFROM legal_services.cases c\nJOIN legal_services.documents d\n ON c.case_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t...
[ { "role": "user", "content": "Which drivers have licenses expiring before 2025-01-01, and what are their first and last names along with the license expiry date?" }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, license_expiry_date FROM transportation.drivers WHERE ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "List all users who have never followed anyone, showing their username, full name, email, and account creation date." }, { "role": "assistant", "content": "SELECT u.username,\n u.full_name,\n u.email,\n u.created_at\nFROM social_media.users AS u\nLE...
You are an SQL statement expert. Given the table 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": "Can you provide a list of all medical records created by doctors for patients who are associated with 'PPO' type insurance plans? I need the record ID, patient ID, doctor ID, record date, and insurance plan name." }, { "role": "assistant", "content": "SELECT mr.reco...
You are an SQL statement expert. Given the table 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": "Show me all active electric vehicles along with their make, model, and license plate, ordered by acquisition date with the newest first." }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, license_plate, acquisition_date FROM transportation.vehicl...
You are an SQL statement expert. Given the table 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": "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": "Show the agency name and the number of employees for each agency that has at least one employee hired after January 1st, 2023." }, { "role": "assistant", "content": "SELECT a.agency_name, COUNT(e.employee_id) AS employee_count\nFROM government_services.agencies a\nJ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "role": "user", "content": "List all comments made on public posts that have a location specified, including comment_id, post_id, comment content, and the comment's created_at timestamp." }, { "role": "assistant", "content": "SELECT c.comment_id,\n c.post_id,\n c.content,\n c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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 the number of players who registered each year. List the registration year and the count." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM registration_date) AS registration_year, COUNT(*) AS player_count FROM gaming_technology.players GROUP B...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "Count the number of unique locations specified in the users table." }, { "role": "assistant", "content": "SELECT count(DISTINCT location) FROM social_media.users WHERE location IS NOT NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "Show me all routes that have a distance greater than 200 km." }, { "role": "assistant", "content": "SELECT route_number, description, distance_km\nFROM transportation.routes\nWHERE distance_km > 200;" }, { "role": "user", "content": "Can you also 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 transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati...
[ { "role": "user", "content": "For each account type, what is the total principal amount outstanding on loans and the average interest rate?" }, { "role": "assistant", "content": "SELECT T2.account_type, SUM(T1.current_principal_balance) AS total_current_loan_principal, AVG(T1.interest_rate) AS a...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "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": "Find all blocks mined in the last 30 days with a nonce value greater than 100000." }, { "role": "assistant", "content": "SELECT * FROM blockchain.blocks WHERE timestamp >= NOW() - INTERVAL '30 days' AND nonce > 100000;" }, { "role": "user", "content": "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 blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta...
[ { "role": "user", "content": "Provide the count of drivers for each status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS driver_count\nFROM transportation.drivers\nGROUP BY status;" }, { "role": "user", "content": "Only include statuses with more than 5 drivers a...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens...
[ { "role": "user", "content": "Show all SUI coins that are marked as 'exists' in both sui_coins and sui_coins_metadata, displaying their coin_type, symbol, name, and balance." }, { "role": "assistant", "content": "SELECT sc.coin_type, scm.symbol, scm.name, sc.balance FROM sui_coins sc JOIN sui_co...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "Retrieve document names and the uploader's full name for all documents with version greater than 1." }, { "role": "assistant", "content": "SELECT d.document_name,\n l.first_name || ' ' || l.last_name AS uploader\nFROM legal_services.documents d\nJOIN legal_ser...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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 wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount." }, { "role": "assistant", "content": "SELECT eb.wallet_address, tm.symbol, eb.amount FROM erc20_balances eb JOIN token_metas tm ON eb.contract_address = tm...
You are an SQL statement expert. Given the table 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": "Show a list of all DApps together with the total number of unique assets linked to each via the metadata table." }, { "role": "assistant", "content": "SELECT d.dapp_id, d.name, d.url, COUNT(DISTINCT m.asset_id) AS unique_asset_count\nFROM trading_platform.dapps d\nL...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "Show the payment ID, amount, and payment method for all payments made in USD with an amount greater than 50." }, { "role": "assistant", "content": "SELECT payment_id, amount, payment_method\nFROM government_services.payments\nWHERE currency = 'USD' AND amount > 50;"...
You are an SQL statement expert. Given the table 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 the license plate, make, and current status of all vehicles acquired after January 1, 2021." }, { "role": "assistant", "content": "SELECT license_plate, make, status \nFROM transportation.vehicles\nWHERE acquisition_date > '2021-01-01';" }, { "role": "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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Find the most recent verified document for each application, showing application_id, document_id, and verification_timestamp." }, { "role": "assistant", "content": "SELECT d.document_id, d.application_id, d.verification_timestamp\nFROM government_services.documents ...
You are an SQL statement expert. Given the table 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.documents ( document_id text PRIMARY KEY, application_id text, citizen_id text, document_type text,...
[ { "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": "What is the total transaction amount for each transaction_type in the last 30 days, considering only 'Completed' status transactions?" }, { "role": "assistant", "content": "SELECT transaction_type, SUM(amount) as total_amount FROM financial_services.transactions WHE...
You are an SQL statement expert. Given the table 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": "Find pairs of notifications for the same application where one was sent via 'Email' and the other via 'SMS'. Display the application_id, email_notification_id, sms_notification_id, email_sent_at, and sms_sent_at." }, { "role": "assistant", "content": "SELECT\n n_em...
You are an SQL statement expert. Given the table 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.notifications ( notification_id character varying(64) NOT NULL, citizen_id character varying(64) NO...
[ { "role": "user", "content": "List each user along with how many image-type posts they've made, showing user_id and image_post_count, sorted by the count descending." }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS image_post_count\nFROM social_media.posts\nWHERE media_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 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 each trip_id along with the number of seats booked and the total fuel cost incurred during that trip." }, { "role": "assistant", "content": "SELECT fl.trip_id, COUNT(b.booking_id) AS seats_booked, SUM(fl.total_cost) AS total_fuel_cost\nFROM transportation.fuel_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "Show me claim IDs, incident dates, and file names for all 'Accident Report' claim documents." }, { "role": "assistant", "content": "SELECT cd.claim_id, cl.incident_date, cd.file_name\nFROM insurance.claim_documents cd\nJOIN insurance.claims cl ON cd.claim_id = cl.cl...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "List all pairs of customers who have the same date of birth but live in different states. For each pair, show both customer IDs, their full names, and the states they reside in." }, { "role": "assistant", "content": "SELECT a.customer_id AS customer_id_a, a.first_na...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...