conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "List the top 5 largest unspent UTXOs by amount, showing utxo_id, address, and amount, ordered descending." }, { "role": "assistant", "content": "SELECT utxo_id, address, amount FROM trading_platform.utxos WHERE spent = false ORDER BY amount DESC LIMIT 5;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "Could you show me each employee's full name along with their manager's full name?" }, { "role": "assistant", "content": "SELECT e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n m.employee_id AS manager_id,\n m.first_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.employees ( employee_id character varying(64) NOT NULL, -- unique identifier for the government...
[ { "role": "user", "content": "Provide a count of cases for each case type." }, { "role": "assistant", "content": "SELECT case_type, count(*) FROM legal_services.cases GROUP BY case_type" }, { "role": "user", "content": "Only include counts for 'Civil Litigation' and 'Criminal Defense...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t...
[ { "role": "user", "content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 6 months, along with their narrative information if available." }, { "role": "assistant", "content": "SELECT pfr.project_name, pfr.rounds_name, pfr.valuation, pfr.investment_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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Show me all creator addresses that deployed smart contracts exactly on February 14th, 2023." }, { "role": "assistant", "content": "SELECT DISTINCT creator_address\nFROM blockchain.smart_contracts\nWHERE timestamp::date = '2023-02-14';" }, { "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 blockchain.smart_contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the smart contra...
[ { "role": "user", "content": "Show me all room types with a base rate over $200 and max occupancy of at least 4, along with their property IDs and amenities." }, { "role": "assistant", "content": "SELECT room_type_id, property_id, type_name, base_rate, max_occupancy, amenities FROM hospitality_t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ...
[ { "role": "user", "content": "Find the total amount transferred between account 'ACC543210' and related accounts in April 2024, showing both the account ID and related account ID." }, { "role": "assistant", "content": "SELECT account_id, related_account_id, SUM(amount) AS total_transferred FROM ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id text PRIMARY KEY, account_id text, related_account_id text, transactio...
[ { "role": "user", "content": "List all messages sent in group chats, including the sender's username, the group name, and the message content." }, { "role": "assistant", "content": "SELECT T1.username , T3.group_name , T2.content FROM users AS T1 JOIN messages AS T2 ON T1.user_id = T2.sender...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message convers...
[ { "role": "user", "content": "Show me all pairs of achievements unlocked by the same player on the same calendar date, returning player_id, achievement_id as achv1, achv2, and the date." }, { "role": "assistant", "content": "SELECT pa1.player_id,\n DATE(pa1.unlocked_at) AS unlock_date,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id...
[ { "role": "user", "content": "List all customers who have policies with a coverage limit above 500000, showing their first name, last name, and the policy number." }, { "role": "assistant", "content": "SELECT t1.first_name, t1.last_name, t2.policy_number FROM insurance.customers AS t1 JOIN insur...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin...
[ { "role": "user", "content": "List all appointments that are currently scheduled and show their appointment time." }, { "role": "assistant", "content": "SELECT appointment_id, patient_id, doctor_id, appointment_time FROM healthcare.appointments WHERE status = 'Scheduled';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "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": "How many distinct posts does each hashtag appear in?" }, { "role": "assistant", "content": "SELECT hashtag_id, COUNT(DISTINCT post_id) AS post_count FROM social_media.post_hashtags GROUP BY hashtag_id;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.post_hashtags ( post_hashtag_id.text, post_id.text, hashtag_id.text )
[ { "role": "user", "content": "For each appointment, show the appointment subject, start time, the client's name, and the lawyer's email." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.subject, a.start_time, c.first_name || ' ' || c.last_name AS client_name, l.email AS lawyer_e...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "How many hidden achievements are there?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM gaming_technology.achievements WHERE hidden = true;" }, { "role": "user", "content": "Also, what is the average point value of all achievements that are n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url t...
[ { "role": "user", "content": "I want a report of user IDs with their KYC status and the count of wallets they have." }, { "role": "assistant", "content": "SELECT k.user_id, k.status, COUNT(w.wallet_id) AS wallet_count\nFROM trading_platform.kyc_audit k\nLEFT JOIN trading_platform.wallets w ON k....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet user_...
[ { "role": "user", "content": "List all passengers along with their ages and loyalty program membership status." }, { "role": "assistant", "content": "SELECT passenger_id, first_name, last_name, date_of_birth, loyalty_program_id, DATE_PART('year', AGE(current_date, date_of_birth)) AS age FROM tra...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.passengers ( passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger ...
[ { "role": "user", "content": "Show me all appointments that have both a non-null location and notes, along with their appointment_id, client_id, lawyer_id, and start_time." }, { "role": "assistant", "content": "SELECT appointment_id, client_id, lawyer_id, start_time FROM legal_services.appointme...
You are an SQL statement expert. Given the table 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.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "List each doctor along with the number of other doctors at the same hospital. Display doctor_id, first_name, last_name, and colleague_count." }, { "role": "assistant", "content": "SELECT d1.doctor_id, d1.first_name, d1.last_name, COUNT(d2.doctor_id) AS colleague_cou...
You are an SQL statement expert. Given the table 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 name and type for all insurance products with a base premium over 5000." }, { "role": "assistant", "content": "SELECT product_name, product_type FROM insurance.insurance_products WHERE base_premium > 5000;" }, { "role": "user", "content": "Can y...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text, product_name text, product_type text, description text, base_premium nu...
[ { "role": "user", "content": "List the name of NFTs and their contract name, along with the symbol and total supply from the token information table, for NFTs on the 'ethereum' blockchain." }, { "role": "assistant", "content": "SELECT T1.name, T1.contract_name, T2.symbol, T2.total_supply FROM nf...
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": "Show me all time entries, including the case name they are associated with." }, { "role": "assistant", "content": "SELECT T1.*, T2.case_name FROM time_entries AS T1 JOIN cases AS T2 ON T1.case_id = T2.case_id" }, { "role": "user", "content": "Only show m...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t...
[ { "role": "user", "content": "I want to see pairs of medications that share the same manufacturer. Show each medication's name and its peer's medication_name along with the manufacturer." }, { "role": "assistant", "content": "SELECT t1.medication_name AS med1_name, t2.medication_name AS med2_nam...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd...
[ { "role": "user", "content": "Show the top 5 tokens by USD value held across all exchanges in the most recent snapshot. Display token_symbol, chain, and the total usd_value, ordered by total usd_value descending." }, { "role": "assistant", "content": "SELECT token_symbol, chain, SUM(usd_value) 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 cex_token_balance (", "snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ...
[ { "role": "user", "content": "What is the average market cap and average 24-hour trading volume for tokens on each chain?" }, { "role": "assistant", "content": "SELECT chain, AVG(market_cap) AS average_market_cap, AVG(volume_24h) AS average_volume_24h FROM token_dexpool_info GROUP BY chain" },...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, token_name character varying(100) NOT NULL, token_sy...
[ { "role": "user", "content": "Show daily total transaction amounts and counts for completed 'Payment' transactions in USD for the last 7 days." }, { "role": "assistant", "content": "SELECT t.effective_date AS date,\n SUM(t.amount) AS total_amount,\n COUNT(*) AS transac...
You are an SQL statement expert. Given the table 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": "Can you provide a list of all maintenance logs for each vehicle, showing the make, model, log ID, service date, and service type?" }, { "role": "assistant", "content": "SELECT v.make, v.model, m.log_id, m.service_date, m.service_type\nFROM transportation.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 character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "Show me all active managers along with their first and last names, and the count of staff members they supervise, ordered by the supervised staff count in descending order." }, { "role": "assistant", "content": "SELECT s1.staff_id, s1.first_name, s1.last_name, 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 hospitality_technology.staff ( staff_id character varying(64) NOT NULL, -- unique identifier for the staff member ...
[ { "role": "user", "content": "List all guests who placed a service order with a total price greater than 200, including their first name, last name, and the order ID." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.order_id FROM hospitality_technology.guests 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.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "Find the application IDs for applications that have received notifications through both 'Email' and 'SMS' channels." }, { "role": "assistant", "content": "SELECT application_id FROM government_services.notifications WHERE channel IN ('Email', 'SMS') GROUP BY 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.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m...
[ { "role": "user", "content": "Show me all appointments with status 'Completed' where the associated medical records have a treatment plan containing 'antibiotics', including the appointment details and the record date." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.patient_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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "List each user's username, email, and the total count of log entries they have recorded." }, { "role": "assistant", "content": "SELECT T1.username, T1.email, count(T2.log_id) FROM users AS T1 LEFT JOIN logs AS T2 ON T1.user_id = T2.user_id GROUP BY T1.user_id, T1.us...
You are an SQL statement expert. Given the table 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": "Which document types have been used for more than 100 documents, and what is the total file size across all documents of each such type?" }, { "role": "assistant", "content": "SELECT document_type, COUNT(*) AS document_count, SUM(file_size_bytes) AS total_file_size_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id character varying(64) NOT NULL, docume...
[ { "role": "user", "content": "Please list all trades for security with ticker symbol 'AAPL', showing the trade id, account number, trade type, quantity, and price per unit." }, { "role": "assistant", "content": "SELECT t.trade_id, a.account_number, t.trade_type, t.quantity, t.price_per_unit\nFRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Show me the top 5 NFT collections on Sui blockchain with the highest number of unique owners, along with their names and collection types." }, { "role": "assistant", "content": "SELECT sn.name, sn.collection_type, COUNT(DISTINCT sn.owner) AS unique_owners_count FROM...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.t...
[ { "role": "user", "content": "List all trips where the passenger_count exceeds the vehicle's capacity. For each trip include trip_id, vehicle license_plate, driver full name, and scheduled_departure." }, { "role": "assistant", "content": "SELECT t.trip_id,\n v.license_plate,\n d.firs...
You are an SQL statement expert. Given the table 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": "Show the content of comments and the content of the posts they belong to, for comments made by users whose location is 'New York'. Also include the username of the commenter." }, { "role": "assistant", "content": "SELECT c.content AS comment_content, p.content AS po...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "List all inactive customers from California who were created in the last 5 years, showing their full names and creation dates." }, { "role": "assistant", "content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'California' AND 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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "List vehicle_id, make, model, and capacity for all vehicles acquired in 2023." }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, capacity\nFROM transportation.vehicles\nWHERE acquisition_date >= '2023-01-01'\n AND acquisition_date <= '2023-12-31...
You are an SQL statement expert. Given the table 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": "Find all patients who have been prescribed medications (recorded in medical records) along with their chief complaints and the medications mentioned in their treatment plans." }, { "role": "assistant", "content": "SELECT DISTINCT p.patient_id, p.first_name, p.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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "How many medical records does each doctor have? Show doctor_id and record_count." }, { "role": "assistant", "content": "SELECT doctor_id,\n COUNT(*) AS record_count\nFROM healthcare.medical_records\nGROUP BY doctor_id;" }, { "role": "user", "conten...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appoi...
[ { "role": "user", "content": "Could you provide a report showing each in-game item's name and the total quantity currently held in player inventories?" }, { "role": "assistant", "content": "SELECT ii.item_name, SUM(pi.quantity) AS total_held FROM gaming_technology.player_inventory pi JOIN gaming...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "Which wallets currently hold more than 100 units of any ERC1155 NFT on Ethereum? Please show contract address, token id, wallet address, and amount." }, { "role": "assistant", "content": "SELECT contract_address, token_id, wallet_address, CAST(amount AS NUMERIC) 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": "Show each player's highest score for each game they have played." }, { "role": "assistant", "content": "SELECT player_id, game_id, MAX(score) AS highest_score FROM gaming_technology.game_sessions GROUP BY player_id, game_id;" }, { "role": "user", "conten...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time...
[ { "role": "user", "content": "Show me all pairs of cases led by the same lawyer, including both case names and the lead lawyer ID." }, { "role": "assistant", "content": "SELECT c1.lead_lawyer_id,\n c1.case_name AS case_name_1,\n c2.case_name AS case_name_2\nFROM legal_services.cases ...
You are an SQL statement expert. Given the table 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": "List all loans originated after '2023-01-01' with a loan type of 'Auto'." }, { "role": "assistant", "content": "SELECT * FROM financial_services.loans WHERE origination_date > '2023-01-01' AND loan_type = 'Auto'" }, { "role": "user", "content": "Sort 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 financial_services.loans ( loan_id.text, account_id.text, loan_type.text, principal_amount.numeric, current_principal_b...
[ { "role": "user", "content": "Please show all items of type 'Consumable', along with their name, rarity, and the total number currently held by all players." }, { "role": "assistant", "content": "SELECT igi.item_id, igi.item_name, igi.rarity, SUM(pi.quantity) AS total_held\nFROM gaming_technolog...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the ...
[ { "role": "user", "content": "List the first name, last name, and status for all drivers." }, { "role": "assistant", "content": "SELECT first_name, last_name, status FROM transportation.drivers;" }, { "role": "user", "content": "How many drivers have a status of 'Active'?" }, { ...
You are an SQL statement expert. Given the table 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": "I want to know the total expenditure of each player on rare items, showing their player_id and total spent." }, { "role": "assistant", "content": "SELECT pi.player_id,\n SUM(igi.cost_amount * pi.quantity) AS total_spent\nFROM gaming_technology.player_inventory...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "List all transaction IDs that contain at least one UTXO marked as spent." }, { "role": "assistant", "content": "SELECT DISTINCT transaction_id FROM utxos WHERE spent = TRUE;" }, { "role": "user", "content": "Now, for those transaction IDs, also include t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.utxos ( utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO transaction...
[ { "role": "user", "content": "List all clients, showing their full name, email, and phone number." }, { "role": "assistant", "content": "SELECT first_name, last_name, email, phone FROM legal_services.clients;" }, { "role": "user", "content": "Now, filter this list to include only cli...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique identifier for the client first_n...
[ { "role": "user", "content": "For each prescription, find the next prescription for the same patient. Return current prescription_id, next_prescription_id, patient_id, and days between start dates." }, { "role": "assistant", "content": "SELECT p1.patient_id,\n p1.prescription_id AS current...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id.text, record_id.text, patient_id.text, doctor_id.text, medication_id.text, d...
[ { "role": "user", "content": "Show all fundraising records from 2023 where the project's valuation was recorded. Display the project name, round name, valuation, and investment value." }, { "role": "assistant", "content": "SELECT project_name, rounds_name, valuation, investment_value FROM projec...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "List application IDs that have both documents and payments associated with them." }, { "role": "assistant", "content": "SELECT DISTINCT T1.application_id FROM documents AS T1 JOIN payments AS T2 ON T1.application_id = T2.application_id" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "role": "user", "content": "Can you provide the mechanic name, service date, and service type for each maintenance log, along with the vehicle's odometer reading for all logs with a cost greater than 1000?" }, { "role": "assistant", "content": "SELECT mechanic_name, service_date, service_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 transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_ty...
[ { "role": "user", "content": "Show me the top 3 narratives by market cap, along with their top 3 coins and 24-hour trading volume." }, { "role": "assistant", "content": "SELECT n.narrative, n.top_3_coins, n.volume_24h FROM narrative_info n ORDER BY n.market_cap DESC LIMIT 3;" }, { "role"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO...
[ { "role": "user", "content": "Find pairs of citizens who share the same gender but registered in different years. Show each citizen's first and last name along with their registration year." }, { "role": "assistant", "content": "SELECT c1.first_name AS first_name_1,\n c1.last_name AS last...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "I want to retrieve all agents along with the number of active policies they've sold and the average premium amount of those active policies. Please include agent_id, first_name, last_name, policy_count, avg_premium. Sort the results by policy_count in descending order." }, ...
You are an SQL statement expert. Given the table 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 the usernames and registration dates for all players whose status is 'inactive'." }, { "role": "assistant", "content": "SELECT username, registration_date FROM players WHERE status = 'inactive';" }, { "role": "user", "content": "Refine the list to o...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show the property name, star rating, and number of rooms for each property." }, { "role": "assistant", "content": "SELECT p.property_name, p.star_rating, COUNT(r.room_id) AS room_count\nFROM hospitality_technology.properties p\nLEFT JOIN hospitality_technology.rooms...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "List the number of users created each year, showing the year and the count, ordered by the year." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM created_at) AS creation_year, COUNT(*) FROM web3.users GROUP BY creation_year ORDER BY creation_year;" ...
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.users ( user_id.text, username.text, email.text, password_hash.text, created_at...
[ { "role": "user", "content": "I need a list of all documents associated with claims, showing the document ID, file name, document type, and the status of the claim it belongs to." }, { "role": "assistant", "content": "SELECT\n cd.document_id,\n cd.file_name,\n cd.document_type,\n c.status 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.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 user who created the most wallets, along with the count of wallets they created and their email address." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, COUNT(w.wallet_id) AS wallet_count FROM trading_platform.users u JOIN trading_platf...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Find all pairs of claims for the same customer where one claim occurred before another. Return customer_id, earlier_claim_id, later_claim_id, earlier_incident_date, and later_incident_date." }, { "role": "assistant", "content": "SELECT c1.customer_id,\n c1.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.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d...
[ { "role": "user", "content": "List all token transfers from address '0xsend...' in the token_activities table, showing the tick, amt, and to_address." }, { "role": "assistant", "content": "SELECT tick, amt, to_address FROM token_activities WHERE from_address = '0xsend...';" }, { "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 nft_holders ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.text, amoun...
[ { "role": "user", "content": "List all rooms that are currently in 'Maintenance' status, including their room numbers and current conditions." }, { "role": "assistant", "content": "SELECT room_number, current_condition FROM hospitality_technology.rooms WHERE status = '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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "Show me the daily number of notifications sent in March 2024." }, { "role": "assistant", "content": "SELECT DATE(sent_at) AS date, COUNT(*) AS notification_count\nFROM government_services.notifications\nWHERE sent_at >= '2024-03-01' AND sent_at < '2024-04-01'\nGROUP...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e...
[ { "role": "user", "content": "Show me the total deposit and withdrawal amounts for each account in February 2024." }, { "role": "assistant", "content": "SELECT account_id, SUM(CASE WHEN transaction_type = 'Deposit' THEN amount ELSE 0 END) AS total_deposit, SUM(CASE WHEN transaction_type = 'Withd...
You are an SQL statement expert. Given the table 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": "Show me all active policies for customers who live in California, along with their total premium payments made so far." }, { "role": "assistant", "content": "SELECT p.policy_id, p.policy_number, c.first_name, c.last_name, p.premium_amount, SUM(pp.amount_paid) AS tot...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer first_...
[ { "role": "user", "content": "Find pairs of distinct routes that share the same destination location but start from different origins. Include the route ID and route number for both routes and the shared destination location ID." }, { "role": "assistant", "content": "SELECT\n r1.route_id AS rou...
You are an SQL statement expert. Given the table 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": "List all room types and the name of the property manager responsible for that property." }, { "role": "assistant", "content": "SELECT t1.type_name, t3.first_name, t3.last_name FROM hospitality_technology.room_types AS t1 JOIN hospitality_technology.properties AS t2 ...
You are an SQL statement expert. Given the table 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": "Which developers have been founded before 2005? Show their name and country." }, { "role": "assistant", "content": "SELECT name, country\nFROM gaming_technology.developers\nWHERE founded_year < 2005;" }, { "role": "user", "content": "Add how many years 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "I would like a list of unread notifications, showing the recipient's username, the sender's full name, the notification_type, and the creation timestamp." }, { "role": "assistant", "content": "```sql\nSELECT\n n.notification_id,\n recipient.username AS recipi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "List all likes that were made on comments. Show the like ID, user ID, comment ID, and the creation time." }, { "role": "assistant", "content": "SELECT like_id, user_id, comment_id, created_at\nFROM social_media.likes\nWHERE 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.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
[ { "role": "user", "content": "Which claims have at least one document uploaded by an agent located in 'NY'? Show the claim_id, document_type, file_name, uploaded_by, and the agent's first and last name." }, { "role": "assistant", "content": "SELECT cd.claim_id, cd.document_type, cd.file_name, cd...
You are an SQL statement expert. Given the table 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": "Which beneficiaries have a percentage_share above 20% on active policies? Show beneficiary_id, first_name, last_name, percentage_share, and policy_number." }, { "role": "assistant", "content": "SELECT pb.beneficiary_id, pb.first_name, pb.last_name, pb.percentage_sha...
You are an SQL statement expert. Given the table 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": "Show each passenger's first_name, last_name, and the total number of bookings they have made." }, { "role": "assistant", "content": "SELECT p.passenger_id, p.first_name, p.last_name, COUNT(b.booking_id) AS booking_count\nFROM transportation.passengers p\nLEFT JOIN t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text...
[ { "role": "user", "content": "List the names of group conversations and the usernames of participants who joined after '2023-01-01'." }, { "role": "assistant", "content": "SELECT T1.group_name, T3.username FROM social_media.conversations AS T1 JOIN social_media.participants AS T2 ON T1.conversat...
You are an SQL statement expert. Given the table 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.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou...
[ { "role": "user", "content": "Show the total maintenance cost for each vehicle." }, { "role": "assistant", "content": "SELECT vehicle_id, SUM(cost) AS total_maintenance_cost FROM transportation.maintenance_logs GROUP BY vehicle_id;" }, { "role": "user", "content": "Can you 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.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "For each group chat, list its ID, name, creation time, and the creation time of the next group chat created after it, ordered by creation time." }, { "role": "assistant", "content": "SELECT conversation_id, group_name, created_at, LEAD(created_at) OVER (ORDER BY 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 social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR...
[ { "role": "user", "content": "List all prescriptions with a dosage greater than 50mg, including the medication ID and patient ID." }, { "role": "assistant", "content": "SELECT prescription_id, medication_id, patient_id FROM healthcare.prescriptions WHERE dosage > '50mg';" }, { "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 healthcare.prescriptions ( prescription_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio...
[ { "role": "user", "content": "Show me the conversation ID and creation time for group chats that have received at least one message." }, { "role": "assistant", "content": "SELECT DISTINCT T1.conversation_id, T1.created_at FROM social_media.conversations AS T1 INNER JOIN social_media.messages 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 social_media.likes ( like_id text, user_id text, post_id text, comment_id text, created_at timestamp ) CREATE TABLE soc...
[ { "role": "user", "content": "For each trip, provide the trip_id, the total fuel quantity refueled, and the number of refueling events that occurred during the trip." }, { "role": "assistant", "content": "SELECT trip_id, SUM(quantity) AS total_fuel_quantity, COUNT(*) AS refuel_event_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 transportation.fuel_logs ( fuel_log_id character varying(64) NOT NULL, -- unique identifier for the fuel log entry...
[ { "role": "user", "content": "Which diagnosis codes have been used for more than 5 different patients? Show the diagnosis_code and the patient count." }, { "role": "assistant", "content": "SELECT diagnosis_code, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.diagnoses GROUP BY diagn...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry ...
[ { "role": "user", "content": "Show me the total billable hours and total billed amount for each lawyer who worked on 'Civil Litigation' cases in 2023, sorted by billed amount descending." }, { "role": "assistant", "content": "SELECT te.lawyer_id,\n SUM(te.hours_spent) AS total_billable_hou...
You are an SQL statement expert. Given the table 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, first_name text, last_name text, company_name text, email text, phone text, ad...
[ { "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": "List all ERC20 tokens where the total supply is between '1000000000' and '5000000000'. Show the symbol and name." }, { "role": "assistant", "content": "SELECT symbol, name FROM token_metas WHERE is_erc20 = 1 AND total_supply >= '1000000000' AND total_supply <= '5000...
You are an SQL statement expert. Given the table 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": "Which agencies have at least one service with a standard fee equal to zero? Show the agency name and the service name." }, { "role": "assistant", "content": "SELECT a.agency_name, s.service_name\nFROM government_services.agencies a\nJOIN government_services.services...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "For each game_id, calculate the average points of achievements that have been unlocked at least once." }, { "role": "assistant", "content": "SELECT a.game_id, AVG(a.points) AS average_unlocked_points FROM gaming_technology.achievements a JOIN gaming_technology.playe...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points....
[ { "role": "user", "content": "Give me the count of clients who registered in each month of 2023." }, { "role": "assistant", "content": "SELECT TO_CHAR(date_registered, 'YYYY-MM') AS reg_month, COUNT(*) AS client_count FROM legal_services.clients WHERE date_registered BETWEEN '2023-01-01' AND '20...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "Find customers who have at least two policies with overlapping coverage periods. Show customer_id, policy1_id, policy2_id, overlap_start and overlap_end." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_id,\n p2.pol...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ...
[ { "role": "user", "content": "Show me all customers (customer_id, first_name, last_name) who have made trades in the last 30 days, along with the total trade amount for each customer, sorted by total trade amount in descending order." }, { "role": "assistant", "content": "SELECT c.customer_id, 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 financial_services.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer ...
[ { "role": "user", "content": "List all inactive customers from Texas who were created in the last 2 years, showing their full names and creation dates." }, { "role": "assistant", "content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'Texas' AND status = 'Ina...
You are an SQL statement expert. Given the table 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": "What is the count of customers for each state where the status is 'Active' and the created_at date is within the last 6 months?" }, { "role": "assistant", "content": "SELECT state, COUNT(*) as customer_count FROM financial_services.customers WHERE status = 'Active' ...
You are an SQL statement expert. Given the table 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": "Which rooms on the 4th floor are non-smoking, along with their property IDs and type IDs?" }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number, room_type_id FROM hospitality_technology.rooms WHERE floor = 4 AND is_smoking = 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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room...
[ { "role": "user", "content": "Show me all service orders placed before 2023-01-01, including order ID, guest ID, and order timestamp." }, { "role": "assistant", "content": "SELECT order_id, guest_id, order_timestamp FROM hospitality_technology.service_orders WHERE order_timestamp < '2023-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 hospitality_technology.service_orders ( order_id text, reservation_id text, guest_id text, service_id text, staff_id_or...
[ { "role": "user", "content": "Show me a list of all notifications that are related to comments. Include the notification ID, the recipient user ID, and the target entity ID, which corresponds to the comment ID." }, { "role": "assistant", "content": "SELECT notification_id, recipient_user_id, tar...
You are an SQL statement expert. Given the table 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 active employees (employee_id, first_name, last_name, department) who were hired in the last 5 years and work in either the 'Investment' or 'Trading' department, sorted by hire_date in descending order." }, { "role": "assistant", "content": "SELECT employee...
You are an SQL statement expert. Given the table 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": "Retrieve a list of beneficiaries who are assigned to more than one policy. Show customer_id, first_name, last_name, and the number of policies they are beneficiaries on." }, { "role": "assistant", "content": "SELECT pb.customer_id, pb.first_name, pb.last_name, 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 insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "List each customer along with the count of other customers living in the same city. Include customer_id, first_name, last_name, city, and other_customer_count." }, { "role": "assistant", "content": "SELECT a.customer_id,\n a.first_name,\n a.last_name,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...