conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Show me all nodes that were last seen in the last 7 days, along with their IP addresses and ports." }, { "role": "assistant", "content": "SELECT node_id, ip_address, port, last_seen FROM blockchain.nodes WHERE last_seen >= CURRENT_DATE - INTERVAL '7 days';" }, {...
You are an SQL statement expert. Given the table 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, ip_address text, port integer, last_seen timestamp ) CREATE TABLE blockchain.users ( ...
[ { "role": "user", "content": "What is the total estimated loss for all claims reported in the year 2024?" }, { "role": "assistant", "content": "SELECT SUM(estimated_loss) FROM insurance.claims WHERE EXTRACT(YEAR FROM reported_date) = 2024;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "How many hashtags were created in each month of 2023?" }, { "role": "assistant", "content": "SELECT TO_CHAR(created_at, 'YYYY-MM') AS month, COUNT(*) AS hashtag_count\nFROM social_media.hashtags\nWHERE created_at BETWEEN '2023-01-01' AND '2023-12-31'\nGROUP BY 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 social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre...
[ { "role": "user", "content": "Find all transactions where the amount is greater than 1000 and the receiver_address starts with '0x1'." }, { "role": "assistant", "content": "SELECT * FROM blockchain.transactions WHERE amount > 1000 AND receiver_address LIKE '0x1%';" }, { "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.transactions ( transaction_id text PRIMARY KEY, block_id text, sender_address text, receiver_address text, a...
[ { "role": "user", "content": "For each user, show the most recently created wallet address and the wallet creation timestamp." }, { "role": "assistant", "content": "SELECT w1.user_id, w1.address, w1.created_at\nFROM web3.wallets w1\nJOIN (\n SELECT user_id, MAX(created_at) AS max_created_at\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.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "Find reviews that contain the word 'dirty' in the comment section, showing the review ID, comment, and rating." }, { "role": "assistant", "content": "SELECT review_id, comment, rating_overall FROM hospitality_technology.reviews WHERE LOWER(comment) LIKE '%dirty%';" ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i...
[ { "role": "user", "content": "Find the total transfer volume for each Avalanche token over the past 7 days and include the token's creator." }, { "role": "assistant", "content": "SELECT a.tick,\n i.creator,\n SUM(a.amt) AS total_volume\nFROM token_activities_avalanche a\nJOIN token_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Show me the total amount of completed transactions and the count of executed trades for each account_id over the past 30 days." }, { "role": "assistant", "content": "SELECT t.account_id,\n SUM(t.amount) AS total_completed_transactions,\n COUNT(tr.trade_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "Which posts have been mentioned with at least one hashtag and also have users who joined the conversation corresponding to the post? Please show the post_id and the user_id of participants." }, { "role": "assistant", "content": "SELECT ph.post_id, cp.user_id\nFROM 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.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text ) CREATE TABLE social_media.conversati...
[ { "role": "user", "content": "List all distinct pairs of hashtag_id that are applied to the same post_id." }, { "role": "assistant", "content": "SELECT ph1.post_id, ph1.hashtag_id AS hashtag1_id, ph2.hashtag_id AS hashtag2_id\nFROM social_media.post_hashtags ph1\nJOIN social_media.post_hashtags ...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, post_id character varying(64) NOT NULL, ha...
[ { "role": "user", "content": "Show me all trips that were completed with vehicles manufactured after 2020, including the vehicle make and model." }, { "role": "assistant", "content": "SELECT t.trip_id, v.make, v.model FROM transportation.trips t JOIN transportation.vehicles v ON t.vehicle_id = v...
You are an SQL statement expert. Given the table 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 loyalty_program_id, how many unique passengers are enrolled and what is the average fare they have paid?" }, { "role": "assistant", "content": "SELECT\n p.loyalty_program_id,\n COUNT(DISTINCT p.passenger_id) AS passenger_count,\n AVG(b.fare) AS avg_fare\...
You are an SQL statement expert. Given the table 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": "Show me the driver first_name, last_name, and the name of the destination location for all trips scheduled to depart between '2024-05-01' and '2024-05-31'." }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, l.name AS destination_name\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.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Find all medical records where the treatment plan includes 'physical therapy' and the patient has an active primary insurance plan, showing the patient ID, record date, and insurance provider details." }, { "role": "assistant", "content": "SELECT mr.patient_id, mr.r...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "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.valuation, pfr.investment_date, ni.narrative, ni....
You are an SQL statement expert. Given the table 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 all past appointments, including the scheduled time, the name of the service, and the name of the location where they took place." }, { "role": "assistant", "content": "SELECT T1.scheduled_start_time, T2.service_name, T3.location_name FROM government_services.a...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Find all pairs of appointments that are scheduled for the same case and overlap in time. Show the IDs of the two overlapping appointments and the shared case ID." }, { "role": "assistant", "content": "SELECT t1.appointment_id AS appointment1_id, t2.appointment_id AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "Show all fuel refueling logs with the fuel_log_id, fuel_type, total_cost, and the name and city of the location where the fueling occurred." }, { "role": "assistant", "content": "SELECT f.fuel_log_id,\n f.fuel_type,\n f.total_cost,\n l.name AS loca...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "Show me the first and last names of citizens, the appointment id, and the department of the employee who scheduled their appointment." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.appointment_id, e.department\nFROM government_services.ap...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List the 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": "List all vehicles that use diesel fuel, showing their make, model, and year." }, { "role": "assistant", "content": "SELECT make, model, year FROM transportation.vehicles WHERE fuel_type = 'diesel';" }, { "role": "user", "content": "Now include only vehic...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "For each Sui NFT with status 'exists', show its object ID, collection type, and owner." }, { "role": "assistant", "content": "SELECT object_id, collection_type, owner FROM sui_nfts WHERE status = 'exists';" }, { "role": "user", "content": "Only show NFTs...
You are an SQL statement expert. Given the table 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": "For each employee who has verified more than one document, list their employee ID, the first document they verified, and the next document they verified, along with both verification timestamps." }, { "role": "assistant", "content": "SELECT\n d1.verified_by_employe...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "role": "user", "content": "Show the name and symbol for all assets in the system." }, { "role": "assistant", "content": "SELECT name, symbol FROM assets;" }, { "role": "user", "content": "Now, include any associated metadata key and value for each asset. If an asset has no metadat...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "List all doctors who have diagnosed chronic conditions, along with the count of such diagnoses per doctor." }, { "role": "assistant", "content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(dg.diagnosis_id) AS chronic_diagnoses_count FROM healthcare.doctors...
You are an SQL statement expert. Given the table 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 the subject and start time for all appointments that are related to a case that also has an invoice. Include the case number and the invoice number." }, { "role": "assistant", "content": "SELECT T1.subject, T1.start_time, T2.case_number, T3.invoice_number 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 legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad...
[ { "role": "user", "content": "Provide the total quantity of items acquired by each player and the most recent acquisition date." }, { "role": "assistant", "content": "SELECT pi.player_id,\n SUM(pi.quantity) AS total_quantity,\n MAX(pi.acquired_at) AS last_acquired_at\nFROM gaming_tec...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, devel...
[ { "role": "user", "content": "List the full name of patients whose primary insurance plan is provided by 'BlueCross BlueShield', along with the plan name." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T3.plan_name FROM healthcare.patients AS T1 JOIN healthcare.patien...
You are an SQL statement expert. Given the table 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, -- unique identifier for this p...
[ { "role": "user", "content": "How many primary insurance policies are currently active for each plan_id? Show plan_id and active_count." }, { "role": "assistant", "content": "SELECT plan_id,\n COUNT(*) AS active_count\nFROM healthcare.patient_insurance\nWHERE is_primary = TRUE\n AND (expi...
You are an SQL statement expert. Given the table 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 text, patient_id text, plan_id text, policy_number text, group_numb...
[ { "role": "user", "content": "Find all users who have deployed contracts on the 'ethereum' network, along with the count of contracts they've deployed and the most recent deployment timestamp." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(c.contract_id) AS contract_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 web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_a...
[ { "role": "user", "content": "List all pairs of loans for the same account where the first loan's principal_amount is greater than the second loan's principal_amount. For each pair, show account_id, loan_id as loan_a and loan_id as loan_b." }, { "role": "assistant", "content": "SELECT l1.account...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, account_id text, loan_type text, principal_amount numeric, current...
[ { "role": "user", "content": "List all depot locations in the United States with their city and state information." }, { "role": "assistant", "content": "SELECT name, city, state_province FROM transportation.locations WHERE type = 'depot' AND country = 'United States';" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro...
[ { "role": "user", "content": "Which chain has the highest total trading volume in the last 24 hours, and what is the top token by volume on that chain?" }, { "role": "assistant", "content": "WITH chain_volume AS (SELECT chain, SUM(volume_24h) AS total_volume_24h FROM token_dexpool_info 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 token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "Show me all premium payments made via credit card in the last 30 days, along with their policy IDs and payment amounts." }, { "role": "assistant", "content": "SELECT payment_id, policy_id, amount_paid, payment_date FROM insurance.premium_payments WHERE payment_metho...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "Show me the top 3 narratives by total USD value of token inflows where smart money was buying (type = 1)." }, { "role": "assistant", "content": "SELECT narrative, SUM(usd_value) AS total_usd_inflow FROM smart_money_token_inflow WHERE type = 1 GROUP BY narrative ORDE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_profit ( address character varying(100) NOT NULL, rank INT, profit numeric(38,6), roi numeric(38,2), realiz...
[ { "role": "user", "content": "Compute the total invoiced amount and average payment delay (in days) by status for invoices issued between 2024-01-01 and 2024-06-30." }, { "role": "assistant", "content": "SELECT status,\n SUM(total_amount) AS total_invoiced,\n AVG(EXTRACT(day FROM (pa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_...
[ { "role": "user", "content": "Count the total number of comments each user has made." }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS comment_count FROM comments GROUP BY 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 social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "Can you tell me the average and maximum session duration for each player and server combination?" }, { "role": "assistant", "content": "SELECT player_id, server_id, AVG(duration_seconds) AS avg_duration, MAX(duration_seconds) AS max_duration\nFROM gaming_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 gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, server_id.uuid, start_time.timestamptz...
[ { "role": "user", "content": "Show me the top 5 most recent medical records with a fever recorded. Return record_id, patient_id, record_date, and the temperature value from vitals." }, { "role": "assistant", "content": "SELECT record_id,\n patient_id,\n record_date,\n vitals->>...
You are an SQL statement expert. Given the table 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": "For each service location, list its name and the number of documents submitted by citizens who scheduled appointments at that location." }, { "role": "assistant", "content": "SELECT sl.location_name, COUNT(d.document_id) AS document_count\nFROM government_services.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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List all reservations, showing the guest's full name (first and last name) and the property name for each." }, { "role": "assistant", "content": "SELECT t2.first_name, t2.last_name, t3.property_name FROM hospitality_technology.reservations AS t1 INNER JOIN hospitali...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List all pairs of service orders that share the same bill_id, showing order1_id, order2_id, and the bill_id." }, { "role": "assistant", "content": "SELECT s1.order_id AS order1_id,\n s2.order_id AS order2_id,\n s1.bill_id\nFROM hospitality_technology.ser...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or...
[ { "role": "user", "content": "List all public posts created in April 2024 along with the username of the author and any hashtags associated with each post." }, { "role": "assistant", "content": "SELECT p.post_id, p.content, p.created_at, u.username, h.tag_name\nFROM social_media.posts p\nJOIN so...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "Show me all ERC20 token contracts that have had at least 200 approvals. Include the token symbol and total approval count." }, { "role": "assistant", "content": "SELECT m.contract_address, m.symbol, COUNT(*) AS approval_count\nFROM erc20_approval a\nJOIN token_metas...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Find pairs of conversations that were created on the same calendar date, showing their IDs and the shared creation date." }, { "role": "assistant", "content": "SELECT c1.conversation_id AS conversation1_id, c2.conversation_id AS conversation2_id, c1.created_at::DATE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR...
[ { "role": "user", "content": "List all available rooms with their room number, property_name, type_name, and the number of days since they were last cleaned." }, { "role": "assistant", "content": "SELECT p.property_name,\n r.room_number,\n rt.type_name,\n date_part('day', curre...
You are an SQL statement expert. Given the table 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": "Count the number of locations for each state or province and display the state and the count." }, { "role": "assistant", "content": "SELECT state_province, COUNT(*) AS location_count FROM transportation.locations GROUP BY state_province;" }, { "role": "user"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro...
[ { "role": "user", "content": "Show me the usernames along with the names of group chats they are participating in and the dates they joined each group." }, { "role": "assistant", "content": "SELECT u.username, c.group_name, cp.joined_at\nFROM social_media.conversation_participants cp\nJOIN socia...
You are an SQL statement expert. Given the table 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 rooms that are currently available (status = 'available') and have a non-smoking policy, along with their room numbers and features." }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number, features FROM 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 character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Show me the top 5 projects by valuation that have completed fundraising rounds in the last 6 months, along with their token symbol and current price from the token_basic_info table." }, { "role": "assistant", "content": "SELECT pfr.project_name, pfr.valuation, tbi.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 project_fundraising_record (", "id character varying(32) NOT NULL, -- fundraising record id", "project_id ch...
[ { "role": "user", "content": "For each claim handler, count the number of documents uploaded for the claims they handled. Return claim_handler_id and document_count." }, { "role": "assistant", "content": "SELECT c.claim_handler_id,\n COUNT(d.document_id) AS document_count\nFROM insurance.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 insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d...
[ { "role": "user", "content": "Show me all securities listed on the 'NYSE' exchange with their ticker symbol and most recent close price." }, { "role": "assistant", "content": "SELECT s.security_name, s.ticker_symbol, md.close_price\nFROM financial_services.securities s\nJOIN financial_services.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 financial_services.securities ( security_id character varying(64) NOT NULL, -- unique identifier for the security ...
[ { "role": "user", "content": "Show each vehicle's ID along with another vehicle's ID where they share the same make but have different models. Sort by the first vehicle_id." }, { "role": "assistant", "content": "SELECT v1.vehicle_id AS vehicle_a, v2.vehicle_id AS vehicle_b\nFROM transportation.v...
You are an SQL statement expert. Given the table 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 premium payments for policy 'POL123'. Show payment ID, payment date, amount paid, and status." }, { "role": "assistant", "content": "SELECT payment_id, payment_date, amount_paid, status FROM insurance.premium_payments WHERE policy_id = 'POL123';" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment po...
[ { "role": "user", "content": "List all maintenance service records for vehicles that have successfully completed any trip." }, { "role": "assistant", "content": "SELECT DISTINCT ml.* FROM transportation.maintenance_logs AS ml JOIN transportation.trips AS t ON ml.vehicle_id = t.vehicle_id WHERE 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.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "What are the environmental impact assessments for the production of the Airbus A350 model?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to data regarding the environmental impact assessments for the production of specific aircraft models...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE manufacturing.aircraft_mod...
[ { "role": "user", "content": "List each appointment with appointment ID, appointment time, doctor's last name, and the patient's primary insurance plan name." }, { "role": "assistant", "content": "SELECT a.appointment_id,\n a.appointment_time,\n d.last_name AS doctor_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 healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ...
[ { "role": "user", "content": "List the citizen IDs for individuals who have both uploaded documents and made payments." }, { "role": "assistant", "content": "SELECT DISTINCT T1.citizen_id FROM documents AS T1 JOIN payments AS T2 ON T1.citizen_id = T2.citizen_id" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "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": "For each exchange, what is the total quantity traded for 'BUY' trades and 'SELL' trades? Show the exchange and the two total quantities." }, { "role": "assistant", "content": "SELECT s.exchange, SUM(CASE WHEN t.trade_type = 'BUY' THEN t.quantity ELSE 0 END) AS total...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "List the policy number, product name, and base premium for all policies sold by agents whose license state is 'TX'." }, { "role": "assistant", "content": "SELECT p.policy_number, ip.product_name, ip.base_premium\nFROM insurance.policies p\nJOIN insurance.insurance_p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "I want to find pairs of developers who share the same website domain. Show each pair's names and the domain." }, { "role": "assistant", "content": "SELECT d1.name AS dev1,\n d2.name AS dev2,\n SPLIT_PART(SPLIT_PART(d1.website, '://', 2), '/', 1) AS domai...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_...
[ { "role": "user", "content": "Show me all premium payments made via credit card in the last 30 days, along with their policy IDs and payment amounts." }, { "role": "assistant", "content": "SELECT payment_id, policy_id, amount_paid FROM insurance.premium_payments WHERE payment_method = 'credit_ca...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo...
[ { "role": "user", "content": "Show the usernames and emails of all users who registered on the same day as at least one other user, along with the registration date." }, { "role": "assistant", "content": "SELECT u1.username, u1.email, u1.created_at\nFROM web3.users u1\nJOIN web3.users u2\n ON 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 web3.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
[ { "role": "user", "content": "List all appointments for doctor 'doctor_A1'." }, { "role": "assistant", "content": "SELECT appointment_id, patient_id, appointment_time, duration_minutes, reason, status, location_id, notes, created_at FROM healthcare.appointments WHERE doctor_id = 'doctor_A1';" ...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the appointment ...
[ { "role": "user", "content": "Retrieve the number of distinct guests for each service order status." }, { "role": "assistant", "content": "SELECT status, COUNT(DISTINCT guest_id) AS guest_count\nFROM hospitality_technology.service_orders\nGROUP BY status;" }, { "role": "user", "conte...
You are an SQL statement expert. Given the table 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": "For each ERC1155 NFT on Ethereum, can you show the contract address, token ID, and the total number of unique wallet holders?" }, { "role": "assistant", "content": "SELECT nh.contract_address, nh.token_id, COUNT(DISTINCT nh.wallet_address) AS unique_holders\nFROM nf...
You are an SQL statement expert. Given the table 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": "For each document verified by an employee, list the document ID, the name of the verifying employee, and the name of the agency the employee belongs to." }, { "role": "assistant", "content": "SELECT T1.document_id, T2.first_name, T2.last_name, T3.agency_name FROM go...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id.text, application_id.text, citizen_id.text, document_type.text, file_refere...
[ { "role": "user", "content": "For each transaction, find the next transaction by the same sender. Show the original transaction_id as current_tx, the next transaction_id as next_tx, from_address, and the time difference in minutes between them." }, { "role": "assistant", "content": "SELECT t1.tr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price...
[ { "role": "user", "content": "Show me the earliest created smart contract for each creator address." }, { "role": "assistant", "content": "SELECT creator_address, MIN(timestamp) as earliest_contract FROM blockchain.smart_contracts GROUP BY creator_address;" }, { "role": "user", "cont...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
[ { "role": "user", "content": "Find all law firms that share the same address, listing each address and the two firm names." }, { "role": "assistant", "content": "SELECT f1.address, f1.firm_name AS firm1, f2.firm_name AS firm2 FROM law_firms f1 JOIN law_firms f2 ON f1.address = f2.address AND f1....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t...
[ { "role": "user", "content": "Show me each developer's name and the number of different games they have published on each platform." }, { "role": "assistant", "content": "SELECT d.name AS developer_name, g.platform, COUNT(DISTINCT g.game_id) AS game_count\nFROM gaming_technology.developers d\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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "For each player, can you show their total session duration and average score for each server they've played on?" }, { "role": "assistant", "content": "SELECT player_id, server_id, SUM(duration_seconds) AS total_duration, AVG(score) AS average_score\nFROM gaming_tech...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time...
[ { "role": "user", "content": "Find pairs of prescriptions for the same patient with overlapping periods. Show p1.prescription_id, p2.prescription_id, patient_id, and the overlap duration in days where the overlap is greater than 15 days." }, { "role": "assistant", "content": "SELECT p1.prescript...
You are an SQL statement expert. Given the table 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": "List all policies with a premium amount between 500 and 1500. Show the policy number, premium amount, and status." }, { "role": "assistant", "content": "SELECT policy_number , premium_amount , status FROM insurance.policies WHERE premium_amount BETWEEN 500 AND 150...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "List pairs of maintenance logs for the same vehicle where the service date is the same, showing the log IDs and service types." }, { "role": "assistant", "content": "SELECT T1.log_id AS log_id_1, T1.service_type AS service_type_1, T2.log_id AS log_id_2, T2.service_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.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "List each insurance product's name and type, along with the number of active policies and the total premium_amount collected for those policies. Only include products that have at least one active policy." }, { "role": "assistant", "content": "SELECT p.product_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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "For each booking, list the booking_id, fare, and the total quantity of fuel consumed on its associated trip." }, { "role": "assistant", "content": "SELECT b.booking_id,\n b.fare,\n SUM(fl.quantity) AS total_fuel_quantity\nFROM transportation.bookings b\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.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text...
[ { "role": "user", "content": "What is the number of active staff members in each position?" }, { "role": "assistant", "content": "SELECT position,\n COUNT(*) AS staff_count\nFROM hospitality_technology.staff\nWHERE is_active = true\nGROUP BY position;" }, { "role": "user", "con...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir...
[ { "role": "user", "content": "For each narrative in token_basic_info, compute the total liquidity and count of tokens from token_dexpool_info. Show narrative, total_liquidity, and token_count." }, { "role": "assistant", "content": "SELECT tbi.narrative,\n SUM(td.liquidity) AS total_liquidity,\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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "Get the count of unread 'message' notifications per group chat, showing conversation_id, group_name, and unread_message_notifications." }, { "role": "assistant", "content": "SELECT c.conversation_id,\n c.group_name,\n COUNT(n.notification_id) AS unread_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 social_media.conversations ( conversation_id.text, created_at.timestamp, last_message_at.timestamp, is_group_chat.boole...
[ { "role": "user", "content": "List the first and last names of all drivers, along with the count of unique vehicle makes they have driven." }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, COUNT(DISTINCT v.make) AS unique_vehicle_makes\nFROM transportation.drivers d\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 transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text...
[ { "role": "user", "content": "Find all blocks that contain transactions where the amount is greater than 500, and include the block difficulty." }, { "role": "assistant", "content": "SELECT DISTINCT b.block_id, b.difficulty FROM blockchain.blocks b JOIN blockchain.transactions t ON b.block_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 blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta...
[ { "role": "user", "content": "Generate a report showing the total number of achievement unlocks broken down by the calendar day they occurred. Show the date and the total number of unlocks for that day." }, { "role": "assistant", "content": "SELECT DATE(unlocked_at) AS unlock_date, COUNT(player_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N...
[ { "role": "user", "content": "For each narrative and chain, what is the total amount and USD value of tokens bought by users (type=1)?" }, { "role": "assistant", "content": "SELECT narrative, chain, SUM(token_amount) AS total_bought_amount, SUM(usd_value) AS total_bought_usd_value\nFROM smart_mo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character...
[ { "role": "user", "content": "For the Arbitrum chain, which three tokens have the greatest positive change in price over the last 1 hour? Please show their symbol, name, price, and 1-hour price change percentage." }, { "role": "assistant", "content": "SELECT token_symbol, token_name, price, pric...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_dexpool_info ( pair_address.text, token_name.text, token_symbol.text, chain.text, price.numeric, price_change_per...
[ { "role": "user", "content": "List each child agency ID and name along with its parent agency ID and name." }, { "role": "assistant", "content": "SELECT c.agency_id AS child_id,\n c.agency_name AS child_name,\n p.agency_id AS parent_id,\n p.agency_name AS parent_name\nFROM gove...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "role": "user", "content": "List all appointments that took place at 'Central Office', showing appointment_id, client_id, and subject." }, { "role": "assistant", "content": "SELECT appointment_id, client_id, subject FROM legal_services.appointments WHERE location = 'Central Office';" }, { ...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, client_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "Show me all active electric vehicles along with their make, model, and license plate, ordered by acquisition date with the newest first." }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, license_plate, acquisition_date FROM transportation.vehicl...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "Show me all users who have placed buy orders but never sell orders, along with their total buy order quantity and average price." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, u.email, SUM(o.quantity) AS total_buy_quantity, AVG(o.price) AS avg_...
You are an SQL statement expert. Given the table 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": "List each player's username along with the names and rarities of items they own, but only include Legendary items." }, { "role": "assistant", "content": "SELECT p.username, igi.item_name, igi.rarity\nFROM gaming_technology.players p\nJOIN gaming_technology.player_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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Find all pairs of developers in the same country but founded in different years. Show each developer's name, their founded_year, and the shared country." }, { "role": "assistant", "content": "SELECT d1.name AS developer1, d2.name AS developer2, d1.country, d1.founde...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_...
[ { "role": "user", "content": "What are the personal contact details of the staff member associated with staff_id 'STAFF789' who worked on a specific maintenance record?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide personal contact details of staff members as this informa...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.m...
[ { "role": "user", "content": "Count the total number of blocks mined for each day of the week." }, { "role": "assistant", "content": "SELECT TO_CHAR(timestamp, 'Day') AS day_of_week, COUNT(*) AS block_count FROM blockchain.blocks GROUP BY day_of_week;" }, { "role": "user", "content":...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta...
[ { "role": "user", "content": "List each patient's first and last name along with their total number of appointments in 2024." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, COUNT(a.appointment_id) AS appointment_count\nFROM healthcare.patients p\nLEFT JOIN healthcare.app...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "What is the count of securities for each security_type in the 'Technology' sector?" }, { "role": "assistant", "content": "SELECT security_type, COUNT(*) as security_count FROM financial_services.securities WHERE sector = 'Technology' GROUP BY security_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 financial_services.securities ( security_id character varying(64) NOT NULL, -- unique identifier for the security ...
[ { "role": "user", "content": "Give a list of all policies where the deductible is less than 1000. Show policy_id, policy_number, start_date, and deductible." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, start_date, deductible\nFROM insurance.policies\nWHERE deductible <...
You are an SQL statement expert. Given the table 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": "Can you show me all developers along with the year they were founded and their website, grouped by country?" }, { "role": "assistant", "content": "SELECT country, array_agg(name) AS developers, array_agg(founded_year) AS founded_years, array_agg(website) AS websites...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_year.integer, website.text, created_...
[ { "role": "user", "content": "List all pairs of achievements unlocked by the same player, showing player_id, achievement1, and achievement2." }, { "role": "assistant", "content": "SELECT pa1.player_id,\n pa1.achievement_id AS achievement1,\n pa2.achievement_id AS achievement2\nFROM g...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti...
[ { "role": "user", "content": "List the name, city, and country of all locations where at least one vehicle is currently assigned (i.e., depot_id matches location_id)." }, { "role": "assistant", "content": "SELECT l.name, l.city, l.country\nFROM transportation.locations l\nJOIN transportation.veh...
You are an SQL statement expert. Given the table 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...