conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "List the total transaction amount per day for the last week." }, { "role": "assistant", "content": "SELECT date_trunc('day', transaction_date) AS day, SUM(amount) AS total_amount\nFROM financial_services.transactions\nWHERE transaction_date >= CURRENT_DATE - INTERVA...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N...
[ { "role": "user", "content": "For each fuel_type, can you calculate the total total_cost and the average total_cost from the fuel_logs table?" }, { "role": "assistant", "content": "SELECT fuel_type,\n SUM(total_cost) AS total_cost_sum,\n AVG(total_cost) AS average_cost\nFROM transpor...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.fuel_logs ( fuel_log_id character varying(64) NOT NULL, -- unique identifier for the fuel log entry...
[ { "role": "user", "content": "For each sector, could you show the sum of volume and the average close price from market_data, including the sector name?" }, { "role": "assistant", "content": "SELECT s.sector, SUM(md.volume) AS total_volume, AVG(md.close_price) AS avg_close_price\nFROM financial_...
You are an SQL statement expert. Given the table 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 reservations with their guest IDs and room IDs where the total amount is greater than $500 and the status is 'Confirmed', ordered by check-in date." }, { "role": "assistant", "content": "SELECT reservation_id, guest_id, room_id, check_in_date, total_amou...
You are an SQL statement expert. Given the table 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": "Can you list each user_id with the count of their completed orders and the sum of quantities of these orders?" }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS completed_order_count, SUM(quantity) AS total_quantity FROM trading_platform.orders 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 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 count of users who registered in each distinct year." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM created_at) AS registration_year, COUNT(*) FROM web3.users GROUP BY registration_year ORDER BY registration_year;" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for the event contract_id characte...
[ { "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": "Get the number of distinct wallet holders and total amount held for each NFT collection on Ethereum. Include collection name and contract_address." }, { "role": "assistant", "content": "SELECT nc.contract_address, nc.name, COUNT(DISTINCT nh.wallet_address) AS holder...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "List all invoices, showing the invoice number, issue date, total amount, and the payment status." }, { "role": "assistant", "content": "SELECT invoice_number, issue_date, total_amount, status FROM invoices" }, { "role": "user", "content": "Only include 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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "I need a report of all notification messages sent to users who have at least one wallet, showing the notification message and the address of one wallet for each user." }, { "role": "assistant", "content": "SELECT n.message, w.address\nFROM trading_platform.notificat...
You are an SQL statement expert. Given the table 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": "List all customer_ids who have both a checking account and a savings account with a combined balance exceeding $50,000." }, { "role": "assistant", "content": "SELECT c.customer_id FROM financial_services.accounts c JOIN financial_services.accounts s ON c.customer_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 financial_services.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "List all prescriptions with the corresponding patient's emergency contact name and phone number. Show prescription ID, patient full name, emergency contact name, and emergency contact phone." }, { "role": "assistant", "content": "SELECT pr.prescription_id, p.first_n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me the post_id, content, author's username, and the number of comments for each post where media_type is 'video'." }, { "role": "assistant", "content": "SELECT p.post_id, p.content, u.username, COUNT(c.comment_id) AS comment_count\nFROM social_media.posts p\nJO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Which customers have more than one beneficiary listed under the same policy? I want to see the policy_id, customer_id, and the count of beneficiaries for each such group." }, { "role": "assistant", "content": "SELECT policy_id, customer_id, COUNT(beneficiary_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 insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "Show the number of active agents in each license state." }, { "role": "assistant", "content": "SELECT license_state,\n COUNT(*) AS active_agent_count\nFROM insurance.agents\nWHERE status = 'active'\nGROUP BY license_state;" } ]
You are an SQL statement expert. Given the table 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": "For each user, calculate the total value of 'buy' and 'sell' orders (quantity * price)." }, { "role": "assistant", "content": "SELECT b.user_id,\n b.total_buy_value,\n s.total_sell_value\nFROM (\n SELECT user_id,\n SUM(quantity * price) AS total...
You are an SQL statement expert. Given the table 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, user_id.text, wallet_id.text, asset_id.text, order_type.text, quantity.numeric...
[ { "role": "user", "content": "List the product_id, product_name, and base_premium for all products that are currently inactive." }, { "role": "assistant", "content": "SELECT product_id, product_name, base_premium\nFROM insurance.insurance_products\nWHERE is_active = false;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "Show me all maintenance logs for 'Engine Repair' service type where the cost is greater than 400, including the vehicle ID, service date, cost, and mechanic name." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost, mechanic_name FROM transp...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ...
[ { "role": "user", "content": "For each vehicle, show the vehicle_id, license_plate, the date of its most recent actual_arrival, and the total number of bookings across all its trips. Only include vehicles that have made at least one trip." }, { "role": "assistant", "content": "SELECT v.vehicle_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.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "List all claim documents for claims handled by the claim handler with ID 'HANDLER_007'. Show document ID, file name, upload time, and claim ID." }, { "role": "assistant", "content": "SELECT cd.document_id, cd.file_name, cd.uploaded_at, cd.claim_id FROM insurance.cla...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "Which games have achievements where the points value is exactly 0? List the game title and the achievement name." }, { "role": "assistant", "content": "SELECT g.title AS game_title, a.name AS achievement_name\nFROM gaming_technology.achievements a\nJOIN gaming_techn...
You are an SQL statement expert. Given the table 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 the patient ID, first name, last name, and email for all patients who have provided both an email address and a phone number." }, { "role": "assistant", "content": "SELECT patient_id, first_name, last_name, email FROM healthcare.patients WHERE email 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "For each chain, find the token with the highest 24h trading volume and the token with the lowest 24h trading volume. Show chain, high_volume_token, high_volume_24h, low_volume_token, and low_volume_24h." }, { "role": "assistant", "content": "WITH max_vol AS (\n SEL...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "Show me the top 10 tokens based on their 24-hour trading volume. Include the token symbol and volume." }, { "role": "assistant", "content": "SELECT token_symbol, volume_24h FROM token_dexpool_info ORDER BY volume_24h DESC LIMIT 10;" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "How many passengers were created each year? Provide the year and passenger_count." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM created_at) AS year, COUNT(*) AS passenger_count\nFROM transportation.passengers\nGROUP BY year\nORDER BY year;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.passengers ( passenger_id character varying(64) NOT NULL, first_name character varying(128) NOT NULL, la...
[ { "role": "user", "content": "For each notification sent through the 'SMS' channel, list the notification ID, message subject, and the full name of the citizen who received it." }, { "role": "assistant", "content": "SELECT n.notification_id, n.message_subject, c.first_name || ' ' || c.last_name ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List employees whose transaction effective_date matches their hire_date anniversary. Show full name and count of such transactions." }, { "role": "assistant", "content": "SELECT e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n COUN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the trans...
[ { "role": "user", "content": "Show the name, description, and URL for all DApps." }, { "role": "assistant", "content": "SELECT name, description, url FROM trading_platform.dapps;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.dapps ( dapp_id character varying(64) NOT NULL, -- unique identifier for the DApp name charac...
[ { "role": "user", "content": "List all staff members who processed payments for guest ID 'G123', including their first name, last name, and the payment ID." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.payment_id FROM staff AS T1 JOIN payments AS T2 ON T1.staff_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 hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position t...
[ { "role": "user", "content": "Show me the full name and specialty of all doctors who have had at least one completed appointment." }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name, T1.last_name, T1.specialty FROM healthcare.doctors AS T1 JOIN healthcare.appointments AS T2 ON 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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor first_name ...
[ { "role": "user", "content": "How many participants in total have not read any messages? (where last_read_at is NULL)" }, { "role": "assistant", "content": "SELECT COUNT(*)\nFROM social_media.conversation_participants\nWHERE last_read_at 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 social_media.conversation_participants ( participant_id character varying(64) NOT NULL, -- unique identifier for th...
[ { "role": "user", "content": "List all pairs of locations that are in the same city. Include their names and the city they are in." }, { "role": "assistant", "content": "SELECT\n l1.name AS location1_name,\n l2.name AS location2_name,\n l1.city\nFROM transportation.locations AS l1\nJOIN trans...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ...
[ { "role": "user", "content": "What are the latest prices for tokens with symbol 'USDT'?" }, { "role": "assistant", "content": "SELECT * FROM token_prices_latest WHERE symbol = 'USDT';" }, { "role": "user", "content": "Now show me the historical prices for 'USDT' from the last 7 days....
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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch...
[ { "role": "user", "content": "For each post, show the number of different users who have commented on it, along with the post_id." }, { "role": "assistant", "content": "SELECT post_id, COUNT(DISTINCT user_id) AS unique_commenters\nFROM social_media.comments\nGROUP BY post_id;" }, { "role...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Provide a count of how many peers were last seen on each distinct day recorded in the system." }, { "role": "assistant", "content": "SELECT DATE(last_seen), COUNT(*) FROM trading_platform.peers GROUP BY DATE(last_seen) ORDER BY DATE(last_seen);" } ]
You are an SQL statement expert. Given the table 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 vehicles that have no associated fuel logs. Include the vehicle's make, model, and license plate." }, { "role": "assistant", "content": "SELECT T1.make , T1.model , T1.license_plate FROM transportation.vehicles AS T1 LEFT JOIN transportation.fuel_logs 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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Which documents have a description that includes the word 'settlement'? Please provide the document name, case ID, and description." }, { "role": "assistant", "content": "SELECT document_name, case_id, description \nFROM legal_services.documents \nWHERE description ...
You are an SQL statement expert. Given the table 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 top 5 tokens by total USD inflow and outflow, including net flow, sorted by net flow descending." }, { "role": "assistant", "content": "WITH inflow AS (\n SELECT token_symbol, chain, SUM(usd_value) AS usd_in\n FROM smart_money_token_inflow\n WHERE 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 smart_money_token_inflow ( token_address.text, token_symbol.text, token_amount.numeric, usd_value.numeric, avg_price.nu...
[ { "role": "user", "content": "List all vehicles where the capacity is less than or equal to 30. Include vehicle_id, make, model, and type." }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, type FROM transportation.vehicles WHERE capacity <= 30;" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "Show me all appointment IDs and their scheduled start times along with the employee ID and service ID for appointments that have been booked using the 'Kiosk' booking method." }, { "role": "assistant", "content": "SELECT appointment_id, scheduled_start_time, employe...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.appointments ( appointment_id text, citizen_id text, employee_id text, location_id text, service_id...
[ { "role": "user", "content": "What is the total number of employees for each status that is not 'Active'?" }, { "role": "assistant", "content": "SELECT status, COUNT(employee_id) AS employee_count FROM financial_services.employees WHERE status != 'Active' GROUP BY status;" }, { "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 financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "List all customers (customer_id, first_name, last_name, email) who have a risk_profile of 'High' and an email address ending with '@gmail.com', along with their city and state information." }, { "role": "assistant", "content": "SELECT customer_id, first_name, last_n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ...
[ { "role": "user", "content": "Show the agent_id, first name, and last name for all agents who were hired before January 1, 2020." }, { "role": "assistant", "content": "SELECT agent_id, first_name, last_name FROM insurance.agents WHERE hire_date < '2020-01-01';" }, { "role": "user", "...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "List all reviews where the cleanliness rating is 3 or below. Include the review comment and the full name of the guest who submitted it." }, { "role": "assistant", "content": "SELECT T1.comment, T2.first_name, T2.last_name FROM hospitality_technology.reviews AS T1 J...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id character varying(64) NOT NULL, -- unique identifier for the ...
[ { "role": "user", "content": "Return the number of top-level comments and the number of replies in the comments table." }, { "role": "assistant", "content": "SELECT\n SUM(CASE WHEN parent_comment_id IS NULL THEN 1 ELSE 0 END) AS top_level_comments,\n SUM(CASE WHEN parent_comment_id IS NOT NULL...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "List all unspent transaction outputs (UTXOs), showing their transaction ID and amount." }, { "role": "assistant", "content": "SELECT transaction_id, amount FROM trading_platform.utxos WHERE spent = false;" }, { "role": "user", "content": "Calculate the t...
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 character varying(64) NOT NULL, username character ...
[ { "role": "user", "content": "List the number of applications submitted by each citizen." }, { "role": "assistant", "content": "SELECT c.citizen_id, c.first_name, c.last_name, COUNT(a.application_id) AS application_count\nFROM government_services.citizens c\nLEFT JOIN government_services.applica...
You are an SQL statement expert. Given the table 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": "List all pairs of billable time entries for the same case." }, { "role": "assistant", "content": "SELECT t1.case_id,\n t1.entry_id AS entry_id_1,\n t2.entry_id AS entry_id_2\nFROM legal_services.time_entries t1\nJOIN legal_services.time_entries t2\n ON ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi...
[ { "role": "user", "content": "Show each contract address and the count of successful transactions sent to that contract." }, { "role": "assistant", "content": "SELECT c.address, COUNT(t.transaction_id) AS success_tx_count FROM web3.contracts c JOIN web3.transactions t ON t.to_address = c.address...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the contract address cha...
[ { "role": "user", "content": "List all cases assigned to lead lawyer ID 'lawyer_abc' that are currently 'Open'. Show the case name, case number, and date opened." }, { "role": "assistant", "content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = '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.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t...
[ { "role": "user", "content": "Find pairs of customers who share the same last name and live in the same city. List the two customer IDs as customer1_id, customer2_id, their first names as first_name1, first_name2, and city." }, { "role": "assistant", "content": "SELECT c1.customer_id AS customer...
You are an SQL statement expert. Given the table 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": "What are the fuel consumption rates per hour for the Boeing 747-8 model?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE manufacturing.aircraft_mod...
[ { "role": "user", "content": "For all currently active policies, show the policy number, the customer's first and last name, and the total amount paid for that policy across all premium payments." }, { "role": "assistant", "content": "SELECT T1.policy_number, T2.first_name, T2.last_name, SUM(T3....
You are an SQL statement expert. Given the table 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": "Provide a count of nodes for each unique IP address and list the IP address along with its node count." }, { "role": "assistant", "content": "SELECT ip_address, COUNT(node_id) AS node_count FROM blockchain.nodes GROUP BY ip_address;" }, { "role": "user", ...
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.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen ti...
[ { "role": "user", "content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a security_type of 'Equity'." }, { "role": "assistant", "content": "SELECT security_id, ticker_symbol, security_name FROM financial_services.securities WH...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac...
[ { "role": "user", "content": "List all room types showing their type name, base rate, and the name of the property where they are offered." }, { "role": "assistant", "content": "SELECT T1.type_name, T1.base_rate, T2.property_name FROM hospitality_technology.room_types AS T1 JOIN hospitality_tech...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "Show me the total principal_amount of all loans for each loan_type." }, { "role": "assistant", "content": "SELECT loan_type, SUM(principal_amount) AS total_principal\nFROM financial_services.loans\nGROUP BY loan_type;" }, { "role": "user", "content": "Ca...
You are an SQL statement expert. Given the table 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": "For each loan, calculate the number of days until maturity. Display loan_id, account_id, maturity_date, and days_to_maturity as the difference between maturity_date and CURRENT_DATE." }, { "role": "assistant", "content": "SELECT loan_id,\n account_id,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same...
[ { "role": "user", "content": "How many medications does each manufacturer have?" }, { "role": "assistant", "content": "SELECT manufacturer, COUNT(*) AS med_count\nFROM healthcare.medications\nGROUP BY manufacturer;" }, { "role": "user", "content": "Only include manufacturers with 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 healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,...
[ { "role": "user", "content": "Retrieve the patient_id, first_name, last_name, and email for all patients who do not have an emergency contact phone number." }, { "role": "assistant", "content": "SELECT patient_id, first_name, last_name, email\nFROM healthcare.patients\nWHERE emergency_contact_ph...
You are an SQL statement expert. Given the table 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 ERC20 token, show the contract address, symbol, and the total number of unique wallet holders based on the current erc20_balances table." }, { "role": "assistant", "content": "SELECT e.contract_address, t.symbol, COUNT(DISTINCT e.wallet_address) AS holder_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "How many notifications are there where the sender user ID is not recorded?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.notifications WHERE sender_user_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 social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "List all NFT collections and their current floor price." }, { "role": "assistant", "content": "SELECT name, floor_price FROM nft_collections" }, { "role": "user", "content": "Also include the number of tokens in each collection." }, { "role": "as...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "List all Sui NFT collections where the owner is not null, including their name and collection_type." }, { "role": "assistant", "content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL;" }, { "role": "user", "content": "Can you also ...
You are an SQL statement expert. Given the table 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": "List addresses on the 'Ethereum' chain that have an ROI greater than 5 and a profit greater than $1000. Show their address, profit, ROI, and realized ratio." }, { "role": "assistant", "content": "SELECT address, profit, roi, realized_ratio FROM smart_money_profit WH...
You are an SQL statement expert. Given the table 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 text, rank numeric, profit numeric, roi numeric, realized_ratio numeric, most_profit_token...
[ { "role": "user", "content": "Find pairs of trades that share the same order_id but have different trade_types." }, { "role": "assistant", "content": "SELECT a.order_id, a.trade_id AS trade_a, a.trade_type AS type_a, b.trade_id AS trade_b, b.trade_type AS type_b\nFROM financial_services.trades 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.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity....
[ { "role": "user", "content": "I need to find all tickets for a specific route 'RT456' along with the car details and route information." }, { "role": "assistant", "content": "SELECT t.ticket_id, t.seat_number, t.price, tc.car_number, tc.car_type, r.route_name, r.description\nFROM train_station_m...
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.train_cars ( car_id character varying(64) NOT NULL, -- ...
[ { "role": "user", "content": "List the vehicle_id, make, model, and total maintenance cost for each vehicle that has undergone maintenance, ordering by total maintenance cost descending." }, { "role": "assistant", "content": "SELECT m.vehicle_id, v.make, v.model, SUM(m.cost) AS total_maintenance...
You are an SQL statement expert. Given the table 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": "List all claim documents uploaded by customers residing in California. Show document ID, file name, and uploaded time." }, { "role": "assistant", "content": "SELECT T1.document_id, T1.file_name, T1.uploaded_at FROM insurance.claim_documents AS T1 JOIN insurance.cust...
You are an SQL statement expert. Given the table 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": "For each game, show the game_id, title, the number of servers currently online, and the total current_players on those servers." }, { "role": "assistant", "content": "SELECT g.game_id, g.title, COUNT(s.server_id) AS online_servers, SUM(s.current_players) AS total_on...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show the wallet address and amount for the token with tick 'ordi', along with its maximum supply from the `token_info` table." }, { "role": "assistant", "content": "SELECT T1.wallet_address, T1.amount, T2.max_supply FROM token_balances AS T1 JOIN token_info AS T2 ON...
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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t...
[ { "role": "user", "content": "List the username and email for all users whose email address ends with '@example.com'." }, { "role": "assistant", "content": "SELECT username, email FROM blockchain.users WHERE email LIKE '%@example.com';" }, { "role": "user", "content": "Now, filter th...
You are an SQL statement expert. Given the table 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.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character va...
[ { "role": "user", "content": "I need the total number of likes each comment has received, including replies. Show comment_id and like_count." }, { "role": "assistant", "content": "SELECT c.comment_id, COUNT(l.like_id) AS like_count\nFROM social_media.comments c\nLEFT JOIN social_media.likes l ON...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "List pairs of distinct patient insurance entries that share the same subscriber_name. Show patient1_id, patient2_id, and subscriber_name." }, { "role": "assistant", "content": "SELECT\n p1.patient_id AS patient1_id,\n p2.patient_id AS patient2_id,\n p1.subscriber...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NO...
[ { "role": "user", "content": "Find the top 5 transactions with the highest gas prices that were successful, including the from_address, to_address, and block_number." }, { "role": "assistant", "content": "SELECT from_address, to_address, block_number, gas_price FROM web3.transactions WHERE statu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add...
[ { "role": "user", "content": "Give me all diagnosis_id and diagnosis_codes for chronic diagnoses made using the ICD-9 code type." }, { "role": "assistant", "content": "SELECT diagnosis_id, diagnosis_code\nFROM healthcare.diagnoses\nWHERE is_chronic = TRUE AND code_type = 'ICD-9';" } ]
You are an SQL statement expert. Given the table 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": "List all managers (employees who are managers to someone else) showing their employee ID, first name, last name, and job title." }, { "role": "assistant", "content": "SELECT DISTINCT m.employee_id, m.first_name, m.last_name, m.job_title\nFROM government_services.emp...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, depa...
[ { "role": "user", "content": "Show me the usernames of users who have the word 'explorer' in their bio." }, { "role": "assistant", "content": "SELECT username\nFROM social_media.users\nWHERE bio ILIKE '%explorer%';" } ]
You are an SQL statement expert. Given the table 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": "Find all doctors created in the last year who have both a phone number and email listed, showing their full name and contact details." }, { "role": "assistant", "content": "SELECT first_name, last_name, phone_number, email FROM healthcare.doctors WHERE created_at >=...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number...
[ { "role": "user", "content": "List the case ID, case number, and case name for all cases with status 'Open'." }, { "role": "assistant", "content": "SELECT case_id, case_number, case_name FROM legal_services.cases WHERE status = 'Open';" }, { "role": "user", "content": "Now, only show...
You are an SQL statement expert. Given the table 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 the names of NFT collections and the wallet addresses that hold NFTs from those collections." }, { "role": "assistant", "content": "SELECT DISTINCT T1.name, T2.wallet_address FROM nft_collections AS T1 JOIN nft_holder_historical AS T2 ON T1.contract_address = T...
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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch...
[ { "role": "user", "content": "Show me the names of law firms and their associated open case numbers." }, { "role": "assistant", "content": "SELECT l.firm_name, c.case_number\nFROM legal_services.law_firms l\nJOIN legal_services.cases c\n ON l.managing_partner_id = c.lead_lawyer_id\nWHERE c.stat...
You are an SQL statement expert. Given the table 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": "For projects that have completed more than one fundraising round, calculate the average investment value across all their recorded rounds. Display the project name and this average value." }, { "role": "assistant", "content": "SELECT project_name, AVG(investment_val...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Show me each comment ID and the total number of likes it has received." }, { "role": "assistant", "content": "SELECT c.comment_id,\n COUNT(l.like_id) AS likes_count\nFROM social_media.comments c\nLEFT JOIN social_media.likes l ON c.comment_id = l.comment_id\nG...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "Show me the list of guests who were created in 2024, along with their first and last names and registration date." }, { "role": "assistant", "content": "SELECT guest_id, first_name, last_name, created_at FROM hospitality_technology.guests WHERE EXTRACT(YEAR FROM cre...
You are an SQL statement expert. Given the table 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.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "Show me all active customers from New York who have at least one active policy with coverage limit above $500,000, along with their policy details." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name, p.policy_id, p.policy_number, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer first_...
[ { "role": "user", "content": "List all games released in 2023 along with their titles, platforms, and the names of their developers." }, { "role": "assistant", "content": "SELECT g.game_id, g.title, g.platform, d.name AS developer_name\nFROM gaming_technology.games g\nJOIN gaming_technology.deve...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date...
[ { "role": "user", "content": "Show me the top 5 wallet addresses with the highest total ERC20 token balances, including their wallet addresses and total amounts." }, { "role": "assistant", "content": "SELECT wallet_address, SUM(CAST(amount AS decimal)) AS total_balance FROM erc20_balances GROUP ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text ) CREATE TABLE e...
[ { "role": "user", "content": "Show me all claims and the file names of documents uploaded for each claim." }, { "role": "assistant", "content": "SELECT T1.claim_id, T2.file_name FROM insurance.claims AS T1 JOIN insurance.claim_documents AS T2 ON T1.claim_id = T2.claim_id;" }, { "role": "...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "List all contracts and the number of different tokens associated with each contract address. Show contract_id, contract address, and token_count." }, { "role": "assistant", "content": "SELECT c.contract_id, c.address, COUNT(DISTINCT t.token_id) AS token_count\nFROM ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "Retrieve the number of passengers for each loyalty_program_id." }, { "role": "assistant", "content": "SELECT loyalty_program_id,\n COUNT(*) AS passenger_count\nFROM transportation.passengers\nGROUP BY loyalty_program_id;" }, { "role": "user", "cont...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "Can you show the total quantity of items acquired on each calendar day?" }, { "role": "assistant", "content": "SELECT DATE(acquired_at) AS acquisition_date, SUM(quantity) AS total_items_acquired FROM gaming_technology.player_inventory GROUP BY acquisition_date;" }...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for...
[ { "role": "user", "content": "Show me all rooms along with their current overall review rating for each room, including the room number and property id." }, { "role": "assistant", "content": "SELECT r.room_number, r.property_id, AVG(rv.rating_overall) AS average_overall_rating\nFROM hospitality_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "List all players from 'Germany' whose status is currently 'online', and show their username and registration date." }, { "role": "assistant", "content": "SELECT username, registration_date FROM gaming_technology.players WHERE country_code = 'DE' AND status = 'online...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "List all reviews with their property IDs and overall ratings where the rating is 4 or higher." }, { "role": "assistant", "content": "SELECT review_id, property_id, rating_overall FROM hospitality_technology.reviews WHERE rating_overall >= 4;" }, { "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 hospitality_technology.reservations ( reservation_id.text, property_id.text, guest_id.text, room_id.text, room_type_id....
[ { "role": "user", "content": "List the first name and last name of citizens who have uploaded documents that are still valid, together with the type of document and the upload timestamp." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, d.document_type, d.upload_timestamp\...
You are an SQL statement expert. Given the table 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 all users who have commented on a post and have also liked any comment on that same post. I want their user IDs and the corresponding post IDs." }, { "role": "assistant", "content": "SELECT DISTINCT c.user_id, c.post_id\nFROM social_media.comments c\nJOIN so...
You are an SQL statement expert. Given the table 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": "How many appointments have a status of 'Cancelled' for each service?" }, { "role": "assistant", "content": "SELECT service_id, COUNT(*) AS cancelled_appointments FROM government_services.appointments WHERE status = 'Cancelled' GROUP BY service_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 government_services.appointments ( appointment_id text, citizen_id text, employee_id text, location_id text, service_id...
[ { "role": "user", "content": "Show me the total number of properties in each country." }, { "role": "assistant", "content": "SELECT country_code, COUNT(*) AS total_properties FROM hospitality_technology.properties GROUP BY country_code;" }, { "role": "user", "content": "Now, filter t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Find all patients who have both a primary insurance plan and at least one completed appointment, along with their insurance policy numbers and the count of appointments." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...