conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "I want to find pairs of transactions where one transaction’s related_account_id matches the other’s account_id, indicating reciprocal transfers between accounts." }, { "role": "assistant", "content": "SELECT t1.transaction_id AS outgoing_txn, t2.transaction_id AS in...
You are an SQL statement expert. Given the table 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 insurance plans, showing their ID, name, provider, and plan type." }, { "role": "assistant", "content": "SELECT plan_id, plan_name, insurance_provider, plan_type FROM healthcare.insurance_plans;" }, { "role": "user", "content": "Filter the list ...
You are an SQL statement expert. Given the table 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": "Find all narratives that have a positive price change percentage over the last hour, 24 hours, and 7 days." }, { "role": "assistant", "content": "SELECT narrative FROM narrative_info WHERE price_change_percentage_1h > 0 AND price_change_percentage_24h > 0 AND price_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume...
[ { "role": "user", "content": "Show me the usernames of users who have posted a comment on a post that includes the hashtag 'nature', along with the content of the comment." }, { "role": "assistant", "content": "SELECT DISTINCT u.username, c.content\nFROM social_media.comments c\nJOIN social_medi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "List the username, registration date, and address of all users who have created a wallet." }, { "role": "assistant", "content": "SELECT u.username, u.created_at AS registration_date, w.address AS wallet_address\nFROM web3.users u\nJOIN web3.wallets w ON u.user_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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "Show all fuel logs for vehicle_id 'VH123', including the timestamp, fuel type, quantity, and the location_id. Sort the list by timestamp descending." }, { "role": "assistant", "content": "SELECT fuel_log_id, log_timestamp, fuel_type, quantity, location_id\nFROM tran...
You are an SQL statement expert. Given the table 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 conversation 'C123', list participant user IDs with their usernames, theme setting, and private_profile flag." }, { "role": "assistant", "content": "SELECT cp.user_id, u.username, us.theme, us.private_profile FROM social_media.conversation_participants cp JOIN s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Count the number of transactions for each block that was created in 2023 and has a difficulty greater than 1000. Show the block ID and the transaction count." }, { "role": "assistant", "content": "SELECT B.block_id, COUNT(T.transaction_id) AS transaction_count FROM ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id chara...
[ { "role": "user", "content": "List all pairs of contracts deployed on the same day by the same deployer. Show deployer_address, deployment date, and both contract IDs." }, { "role": "assistant", "content": "SELECT\n c1.deployer_address,\n DATE(c1.deployed_at) AS deployment_date,\n c1.contract...
You are an SQL statement expert. Given the table 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": "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": "Find the total quantity dispensed and the number of refills allowed for each dosage type." }, { "role": "assistant", "content": "SELECT dosage, SUM(quantity_dispensed) AS total_quantity_dispensed, SUM(refills_allowed) AS total_refills_allowed FROM healthcare.prescri...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, pa...
[ { "role": "user", "content": "Show me all log entries for user ID 'user123'." }, { "role": "assistant", "content": "SELECT log_id, user_id, action, details, logged_at FROM trading_platform.logs WHERE user_id = 'user123' ORDER BY logged_at DESC;" }, { "role": "user", "content": "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 trading_platform.logs ( log_id character varying(64) NOT NULL, user_id character varying(64), action character varying(...
[ { "role": "user", "content": "Show all currently available rooms along with their room numbers and the number of times each room has been reserved." }, { "role": "assistant", "content": "SELECT rm.room_id, rm.room_number, COUNT(r.reservation_id) AS reservation_count\nFROM hospitality_technology....
You are an SQL statement expert. Given the table 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": "List the name and latest price for all tokens that have a price listed." }, { "role": "assistant", "content": "SELECT t1.name, t2.price FROM token_metas AS t1 JOIN token_prices AS t2 ON t1.contract_address = t2.address WHERE t2.timestamp IN (SELECT MAX(timestamp) FR...
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.text,...
[ { "role": "user", "content": "List all claim documents along with the beneficiary first and last names and their relationship for policies where a document of type 'MEDICAL_REPORT' exists." }, { "role": "assistant", "content": "SELECT cd.document_id, cd.claim_id, cd.file_name, cd.document_type, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Find all wallets that were created by users with IDs starting with 'admin_' and show their addresses along with creation timestamps." }, { "role": "assistant", "content": "SELECT address, created_at FROM web3.wallets WHERE user_id LIKE 'admin_%';" } ]
You are an SQL statement expert. Given the table 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.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
[ { "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": "Retrieve a list of agents who were hired in 2024. Include agent_id, first_name, last_name, hire_date." }, { "role": "assistant", "content": "SELECT agent_id, first_name, last_name, hire_date\nFROM insurance.agents\nWHERE hire_date >= '2024-01-01' AND hire_date < '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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "Show me appointment_id, start_time, subject, case_number, and status for all appointments scheduled for tomorrow." }, { "role": "assistant", "content": "SELECT a.appointment_id,\n a.start_time,\n a.subject,\n c.case_number,\n a.status\nFROM l...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man...
[ { "role": "user", "content": "Show the total value and total gas used for all transactions occurring in each distinct year." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM timestamp) AS transaction_year, SUM(value) AS total_value, SUM(gas_used) AS total_gas_used FROM web3.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 web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.numeric, gas_used.integer, gas_price...
[ { "role": "user", "content": "List each user along with the total number of public posts they have made, and the names of any hashtags associated with their posts." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(DISTINCT p.post_id) AS public_post_count, STRING_AGG(DIST...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Show all beneficiaries who were added in 2024 for any policy. List their beneficiary_id, first and last name, relationship, and the policy_id." }, { "role": "assistant", "content": "SELECT beneficiary_id, first_name, last_name, relationship, policy_id\nFROM insuranc...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "How many reviews does each staff member respond to, along with their full name and the average response time in hours?" }, { "role": "assistant", "content": "SELECT st.staff_id,\n st.first_name || ' ' || st.last_name AS staff_full_name,\n COUNT(*) AS res...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "Show the booking ID and seat number for all bookings that have a fare equal to 50." }, { "role": "assistant", "content": "SELECT booking_id, seat_number\nFROM transportation.bookings\nWHERE fare = 50;" }, { "role": "user", "content": "Also include the bo...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "List all room numbers with their room type name and property name for rooms that have a Jacuzzi feature." }, { "role": "assistant", "content": "SELECT r.room_number, rt.type_name, p.property_name\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.room...
You are an SQL statement expert. Given the table 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": "Get me the total number of vehicles for each fuel_type." }, { "role": "assistant", "content": "SELECT fuel_type,\n COUNT(*) AS total_vehicles\nFROM transportation.vehicles\nGROUP BY fuel_type;" }, { "role": "user", "content": "Only show fuel types ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Find 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": "I want to find all pairs of wallets that belong to the same user." }, { "role": "assistant", "content": "SELECT w1.wallet_id AS wallet1, w2.wallet_id AS wallet2, w1.user_id\nFROM blockchain.wallets w1\nJOIN blockchain.wallets w2\n ON w1.user_id = w2.user_id\n AND ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address_id chara...
[ { "role": "user", "content": "Show me the average order price and total quantity traded for each asset, but only for completed orders in the last 30 days." }, { "role": "assistant", "content": "SELECT asset_id, AVG(price) AS avg_price, SUM(quantity) AS total_quantity FROM trading_platform.orders...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch...
[ { "role": "user", "content": "How many wallets were created in each distinct month?" }, { "role": "assistant", "content": "SELECT DATE_TRUNC('month', created_at) AS creation_month, COUNT(*) AS wallet_count FROM web3.wallets GROUP BY DATE_TRUNC('month', created_at) ORDER BY creation_month;" }, ...
You are an SQL statement expert. Given the table 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.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
[ { "role": "user", "content": "List all transactions together with any event emitted in the same transaction, showing transaction ID, event name, and event emitted timestamp." }, { "role": "assistant", "content": "SELECT tx.transaction_id, ev.event_name, ev.emitted_at\nFROM web3.transactions tx\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "List all inactive insurance products along with their creation dates." }, { "role": "assistant", "content": "SELECT product_name, created_at FROM insurance.insurance_products WHERE is_active = false;" }, { "role": "user", "content": "Now order them by 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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "List all patients who have been prescribed medications with dosage greater than 50mg, along with their medication details and prescribing doctor's name." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, pr.dosage, pr.medication_id, pr.frequenc...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List all servers that are currently online and have a player count greater than their average player count across all servers in the same region." }, { "role": "assistant", "content": "SELECT s.server_id, s.server_name, s.region, s.current_players\nFROM 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.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time...
[ { "role": "user", "content": "For each client, show the earliest and latest invoice issue_date, along with the total amount invoiced. Include client_id, earliest_issue_date, latest_issue_date, and total_amount." }, { "role": "assistant", "content": "SELECT client_id, MIN(issue_date) AS earliest_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_...
[ { "role": "user", "content": "For each claim, list the incident date, the policy number, and the number of beneficiaries associated with that policy." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, p.policy_number, COUNT(pb.beneficiary_id) AS beneficiary_count\nFROM in...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "For each appointment scheduled for '2024-08-15', return the patient's full name, the doctor's ID, and the appointment time." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, a.doctor_id, a.appointment_time\nFROM healthcare.appointments a\nJOIN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List the first name, last name, and hire date for all lawyers who were hired after the year 2020." }, { "role": "assistant", "content": "SELECT first_name, last_name, hire_date FROM legal_services.lawyers WHERE hire_date > '2020-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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 12 months, along with their latest round name and investment value." }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, valuation 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.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "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": "Show me the top 3 smart money addresses by profit on the Ethereum chain, along with their most profitable token and ROI." }, { "role": "assistant", "content": "SELECT address, most_profit_token, roi FROM smart_money_profit WHERE chain = 'Ethereum' ORDER BY profit DE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative character varying(512) NOT NULL, -- the id of narrative top_3_coins text, -- the top 3 token...
[ { "role": "user", "content": "For each account status, what is the total quantity of securities traded?" }, { "role": "assistant", "content": "SELECT T2.status, SUM(T1.quantity) FROM financial_services.trades AS T1 JOIN financial_services.accounts AS T2 ON T1.account_id = T2.account_id GROUP BY ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "Find all nodes that share the same IP address but have different node_ids." }, { "role": "assistant", "content": "SELECT n1.ip_address, n1.node_id AS node_id1, n2.node_id AS node_id2 FROM blockchain.nodes n1 JOIN blockchain.nodes n2 ON n1.ip_address = n2.ip_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 blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
[ { "role": "user", "content": "List the full name of all patients who have no prescriptions recorded in the system." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name FROM healthcare.patients AS T1 LEFT JOIN healthcare.prescriptions AS T2 ON T1.patient_id = T2.patient_id 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show pairs of customers who share the same email domain but have different last names. Include their IDs, full names, and email domain." }, { "role": "assistant", "content": "SELECT a.customer_id AS customer_a_id, a.first_name AS customer_a_first_name, a.last_name A...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "I need to retrieve asset IDs along with their category and website metadata values for assets that have both entries." }, { "role": "assistant", "content": "SELECT m_cat.asset_id,\n m_cat.value AS category,\n m_web.value AS website_url\nFROM trading_plat...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.metadata ( metadata_id character varying(64) NOT NULL, asset_id character varying(64) NOT NULL, key ch...
[ { "role": "user", "content": "List all drivers who have email addresses but no contact number recorded in the system." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, email FROM transportation.drivers WHERE email IS NOT NULL AND contact_number 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 transportation.drivers ( driver_id character varying(64) NOT NULL, -- unique identifier for the driver employe...
[ { "role": "user", "content": "Show me all claims with police reports that were filed in the last 3 months, along with the policy details and customer information." }, { "role": "assistant", "content": "SELECT c.claim_id, c.policy_id, c.customer_id, c.incident_date, c.reported_date, c.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 insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "Show me the full name of every lawyer, their specialization, and the number of cases they are the lead lawyer for." }, { "role": "assistant", "content": "SELECT CONCAT(l.first_name, ' ', l.last_name) AS lawyer_name, l.specialization, COUNT(c.case_id) AS lead_case_co...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "role": "user", "content": "List all active drivers with their license expiry dates and contact information." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, license_number, license_expiry_date, contact_number, email FROM transportation.drivers WHERE status = 'ac...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "I want to see for each server region the total number of servers and the average duration of all sessions hosted in that region." }, { "role": "assistant", "content": "SELECT s.region, COUNT(DISTINCT s.server_id) AS server_count, AVG(gs.duration_seconds) AS avg_dura...
You are an SQL statement expert. Given the table 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": "List all users who have received any notification, showing their username and the total number of notifications they received. Assume a users table with user_id and username exists." }, { "role": "assistant", "content": "SELECT u.username, COUNT(n.notification_id) F...
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.utxos ( utxo_id text PRIMARY KEY, transaction_id text, output_index...
[ { "role": "user", "content": "List users who commented on posts and the content of the post they commented on. Show commenter username and post content." }, { "role": "assistant", "content": "SELECT T1.username, T2.content FROM social_media.users AS T1 JOIN social_media.comments AS T3 ON T1.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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Find currently employed employees whose direct manager has been terminated. Display the employee's full name, hire date, manager's full name, and manager's termination date." }, { "role": "assistant", "content": "SELECT e.employee_id,\n CONCAT(e.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.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List all likes on comments, showing the comment ID, the user who liked it, and the creation time of the like." }, { "role": "assistant", "content": "SELECT comment_id, user_id, created_at FROM social_media.likes WHERE comment_id IS NOT NULL" }, { "role": "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 social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "For each reservation, show the guest's first and last name, the property name, and the names of all services ordered during that reservation." }, { "role": "assistant", "content": "SELECT r.reservation_id, g.first_name, g.last_name, p.property_name, s.service_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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "For each wallet, show the wallet address and the total value of tokens they have received across all token transfers." }, { "role": "assistant", "content": "SELECT w.address, COALESCE(SUM(tt.value), 0) AS total_received_value\nFROM web3.wallets w\nLEFT JOIN web3.tok...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id text, contract_id text, event_name text, data text, emitted_at timestamp, transaction_id text, l...
[ { "role": "user", "content": "List all wallet addresses holding at least 2 different NFTs from the same contract on Ethereum. Show contract_address, wallet_address, and the count of token_ids held." }, { "role": "assistant", "content": "SELECT contract_address, wallet_address, COUNT(DISTINCT tok...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_i...
[ { "role": "user", "content": "Show the total amount of tokens transferred for each token_id along with the number of transfers involving each token." }, { "role": "assistant", "content": "SELECT token_id, SUM(value) AS total_transferred, COUNT(*) AS transfer_count FROM web3.token_transfers 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 web3.token_transfers ( transfer_id text, token_id text, from_address text, to_address text, value numeric, transaction_...
[ { "role": "user", "content": "I need to find, for each active agent, the number of active policies they have sold and the average premium_amount of those active policies." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name || ' ' || a.last_name AS agent_name, COUNT(p.policy_id...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer first_...
[ { "role": "user", "content": "Find all documents that are associated with an application but have a verification status of 'Pending'. Show the document ID, document type, and application ID." }, { "role": "assistant", "content": "SELECT document_id, document_type, application_id FROM government_...
You are an SQL statement expert. Given the table 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": "Retrieve review comments and their overall rating for properties that currently have at least one room with a status of 'Available'. Include the review ID, property ID, and review date." }, { "role": "assistant", "content": "SELECT r.review_id, r.comment, r.rating_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 hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i...
[ { "role": "user", "content": "Count the number of lawyers in each firm. Show the firm ID and the count." }, { "role": "assistant", "content": "SELECT firm_id, COUNT(*) AS lawyer_count FROM legal_services.lawyers GROUP BY firm_id ORDER BY firm_id;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "role": "user", "content": "Show me the first and last names of all customers who have filed a claim, along with the claim ID and incident date." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, cl.claim_id, cl.incident_date\nFROM insurance.customers c\nJOIN insurance.cl...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "For each item, can you show the total quantity held by all players and the most recent acquisition date for that item?" }, { "role": "assistant", "content": "SELECT item_id, SUM(quantity) AS total_quantity, MAX(acquired_at) AS last_acquired_at\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.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for...
[ { "role": "user", "content": "Show me all customers who have active policies with coverage limits over $1,000,000, along with their policy details and the product names." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name, p.policy_id, p.policy_number, p.start_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "List the contract ID, address, and deployer address for all contracts deployed on the 'mainnet' network." }, { "role": "assistant", "content": "SELECT contract_id, address, deployer_address FROM web3.contracts WHERE network_id = 'mainnet';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "List all female patients born before 1990 who have a phone number listed, showing their full names and contact information." }, { "role": "assistant", "content": "SELECT first_name, last_name, phone_number, email, emergency_contact_name, emergency_contact_phone 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List the IDs of posts and their respective number of hashtags for posts that have two or more hashtags." }, { "role": "assistant", "content": "SELECT post_id, COUNT(hashtag_id) AS hashtag_count\nFROM social_media.post_hashtags\nGROUP BY post_id\nHAVING COUNT(hashtag...
You are an SQL statement expert. Given the table 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, post_id character varying(64) NOT NULL, user_id char...
[ { "role": "user", "content": "Which game has the longest total session time across all its sessions?" }, { "role": "assistant", "content": "SELECT game_id, SUM(duration_seconds) AS total_session_time\nFROM gaming_technology.game_sessions\nGROUP BY game_id\nORDER BY total_session_time DESC\nLIMIT...
You are an SQL statement expert. Given the table 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 top 5 accounts by total commission paid in trades during June 2024. Include account_number and total_commission." }, { "role": "assistant", "content": "SELECT a.account_number,\n SUM(t.commission) AS total_commission\nFROM financial_services.trades 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 financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "Show me the total transaction amount by transaction_type for all transactions processed by employees in the 'Trading' department, along with their department name." }, { "role": "assistant", "content": "SELECT t.transaction_type, SUM(t.amount) AS total_amount, e.dep...
You are an SQL statement expert. Given the table 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 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": "Show all diagnosis codes and descriptions for patients diagnosed by doctor 'doctor_789'." }, { "role": "assistant", "content": "SELECT patient_id, diagnosis_code, description FROM healthcare.diagnoses WHERE doctor_id = 'doctor_789';" }, { "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 healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty...
[ { "role": "user", "content": "List the transaction IDs that have both an event and a token transfer, along with the name of the event and the value of the token transfer." }, { "role": "assistant", "content": "SELECT T1.transaction_id, T1.event_name, T2.value FROM web3.events AS T1 JOIN web3.tok...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Show the payment_id and amount_paid for all premium payments where the status is 'pending'." }, { "role": "assistant", "content": "SELECT payment_id, amount_paid\nFROM insurance.premium_payments\nWHERE status = 'pending';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,...
[ { "role": "user", "content": "List all posts where the content mentions 'meeting'." }, { "role": "assistant", "content": "SELECT post_id, user_id, content, created_at FROM social_media.posts WHERE content LIKE '%meeting%'" }, { "role": "user", "content": "Also, only include those pos...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "For each passenger, show their full name, email, and the number of unique trips they have participated in." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, p.email, COUNT(DISTINCT b.trip_id) AS unique_trips\nFROM transportation.passengers p\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 transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti...
[ { "role": "user", "content": "Find all pairs of achievement unlocks and item acquisitions by the same player where the item was acquired after the achievement was unlocked. List player_id, achievement_id, unlocked_at, item_id, and acquired_at." }, { "role": "assistant", "content": "SELECT pa.pla...
You are an SQL statement expert. Given the table 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": "Get each property's name, manager_staff_id, and the number of rooms with status 'OutOfOrder', including properties with zero OutOfOrder rooms." }, { "role": "assistant", "content": "SELECT p.property_name, p.manager_staff_id, COUNT(r.room_id) AS out_of_order_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": "Find the names of service locations where services categorized as 'Licensing' have had appointments scheduled." }, { "role": "assistant", "content": "SELECT DISTINCT T1.location_name FROM service_locations AS T1 JOIN appointments AS T2 ON T1.location_id = T2.locatio...
You are an SQL statement expert. Given the table 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.services ( service_id character varying(64) NOT NULL, -- unique identifier for the service ...
[ { "role": "user", "content": "Show the names of group conversations and how many participants they have." }, { "role": "assistant", "content": "SELECT c.group_name, count(cp.user_id) AS participant_count FROM social_media.conversations AS c JOIN social_media.conversation_participants AS cp ON c....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "Can you give me the number of available services and their average price for each department?" }, { "role": "assistant", "content": "SELECT department, COUNT(*) AS available_services_count, AVG(price) AS average_price\nFROM hospitality_technology.services\nWHERE is_...
You are an SQL statement expert. Given the table 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.services ( service_id text, property_id text, service_name text, description text, category text...
[ { "role": "user", "content": "How many addresses on the Ethereum chain have an ROI between 2 and 4?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE chain = 'Ethereum' AND roi >= 2 AND roi <= 4;" }, { "role": "user", "content": "Co...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_profit ( address text, rank numeric, profit numeric, roi numeric, realized_ratio numeric, most_profit_token...
[ { "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 users who have never posted any public posts, showing user_id, username, and email." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, u.email FROM social_media.users u LEFT JOIN social_media.posts p ON p.user_id = u.user_id AND p.visibili...
You are an SQL statement expert. Given the table 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": "For each transaction_id in the utxos table, show the transaction_id and the total number of UTXOs associated with it, sorted by the count descending." }, { "role": "assistant", "content": "SELECT transaction_id,\n COUNT(*) AS utxo_count\nFROM trading_platform....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.assets ( asset_id character varying(64) NOT NULL, -- unique identifier for the asset name cha...
[ { "role": "user", "content": "List all patients born in the 1980s, including their full names and genders." }, { "role": "assistant", "content": "SELECT CONCAT(first_name, ' ', last_name) AS full_name, gender FROM healthcare.patients WHERE date_of_birth BETWEEN '1980-01-01' AND '1989-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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "For each user, show their username and the timestamp of their most recent notification. Include users who have never received notifications." }, { "role": "assistant", "content": "SELECT T1.username, max(T2.sent_at) FROM users AS T1 LEFT JOIN trading_platform.notifi...
You are an SQL statement expert. Given the table 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.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp...
[ { "role": "user", "content": "List all employees with the job title 'Analyst'. Show their first name, last name, and department." }, { "role": "assistant", "content": "SELECT first_name, last_name, department\nFROM government_services.employees\nWHERE job_title = 'Analyst';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text, agency_name text, jurisdiction_level text, primary_contact_email text, m...
[ { "role": "user", "content": "Find any two claims made by the same customer on the same day. Return customer_id, the two claim IDs, and the incident date." }, { "role": "assistant", "content": "SELECT c1.customer_id,\n c1.claim_id AS claim1_id,\n c2.claim_id AS claim2_id,\n DAT...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d...
[ { "role": "user", "content": "What is the average estimated_duration_minutes for each route type?" }, { "role": "assistant", "content": "SELECT type, AVG(estimated_duration_minutes) AS average_duration FROM transportation.routes GROUP BY type;" }, { "role": "user", "content": "Now fi...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "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 document ID, document_type, verification_timestamp, the full name of the employee who verified each document, and the agency_name for all documents verified in the last 30 days." }, { "role": "assistant", "content": "SELECT d.document_id,\n d.document...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "List the booking ID, the first name, and the last name of the passenger for all bookings." }, { "role": "assistant", "content": "SELECT T1.booking_id , T2.first_name , T2.last_name FROM transportation.bookings AS T1 JOIN transportation.passengers AS T2 ON T1.passeng...
You are an SQL statement expert. Given the table 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 all comments on a given post along with the commenter’s username and the comment time." }, { "role": "assistant", "content": "SELECT c.comment_id, c.content, u.username, c.created_at\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = u.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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "How many unread messages does each sender have? Show sender_user_id and count of messages where read_at is null." }, { "role": "assistant", "content": "SELECT sender_user_id, COUNT(*) AS unread_messages\nFROM social_media.messages\nWHERE read_at IS NULL\nGROUP BY se...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.messages ( message_id.text, conversation_id.text, sender_user_id.text, content.text, media_url.text, media...
[ { "role": "user", "content": "Find all contracts whose address appears in token transfers and show the contract_id, address, and the total number of transfers involving that address (either as sender or recipient)." }, { "role": "assistant", "content": "SELECT\n c.contract_id,\n c.address,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "List all active SUI coins with status 'exists' in metadata, showing coin_type, symbol, name, balance, and description." }, { "role": "assistant", "content": "SELECT sc.coin_type, sm.symbol, sm.name, sc.balance, sm.description\nFROM sui_coins sc\nJOIN sui_coins_metad...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "I need a report that shows, for each account status and loan type, how many loans there are and the average principal amount." }, { "role": "assistant", "content": "SELECT a.status,\n l.loan_type,\n COUNT(*) AS total_loans,\n AVG(l.principal_amount...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same...