conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me all active customers from New York who have at least one active policy with coverage limit above $500,000, along with their policy details."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name, c.last_name, p.policy_id, p.policy_number, ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "How many pairs of distinct locations are there that share the same state or province but are in different cities?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM transportation.locations AS l1 JOIN transportation.locations AS l2 ON l1.state_province = l2... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, ... |
[
{
"role": "user",
"content": "For each doctor, count the number of chronic diagnoses they have made. Show the doctor's full name and the count."
},
{
"role": "assistant",
"content": "SELECT doc.first_name, doc.last_name, COUNT(d.diagnosis_id) FROM healthcare.doctors doc JOIN healthcare.diagnoses... | You are an SQL statement expert. Given the table 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": "Retrieve the application_id, citizen_id, service_id, and service_name for all applications with status = 'Pending'."
},
{
"role": "assistant",
"content": "SELECT a.application_id, a.citizen_id, a.service_id, s.service_name\nFROM government_services.applications a\nJ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eli... |
[
{
"role": "user",
"content": "List the user IDs and the date they joined their most recent conversation."
},
{
"role": "assistant",
"content": "SELECT user_id, MAX(joined_at) AS most_recent_joined_at\nFROM social_media.conversation_participants\nGROUP BY user_id;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversation_participants ( participant_id text, conversation_id text, user_id text, joined_at timestamp, ... |
[
{
"role": "user",
"content": "Show the appointment ID, scheduled start time, and the full name of the citizen for all appointments related to services with a standard fee greater than 150."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.scheduled_start_time, c.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 PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show the total number of documents uploaded for each lawyer. Display the lawyer's first and last name and the document count."
},
{
"role": "assistant",
"content": "SELECT l.first_name, l.last_name, COUNT(d.document_id) AS document_count\nFROM legal_services.lawyers... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "List all token transfers, showing the transfer ID, value, and the symbol of the token transferred."
},
{
"role": "assistant",
"content": "SELECT T1.transfer_id, T1.value, T2.token_symbol FROM web3.token_transfers AS T1 JOIN web3.tokens AS T2 ON T1.token_id = T2.toke... | You are an SQL statement expert. Given the table 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 the claim_id and the total number of documents uploaded for each claim, but only include claims with between 3 and 7 documents."
},
{
"role": "assistant",
"content": "SELECT claim_id, COUNT(*) AS document_count FROM insurance.claim_documents GROUP BY claim_id H... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id.text, claim_id.text, document_type.text, file_name.text, file_path.text, file_s... |
[
{
"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 fuel logs where the location is 'LOC456', including the vehicle ID, fuel type, and quantity."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, fuel_type, quantity FROM transportation.fuel_logs WHERE location_id = 'LOC456';"
},
{
"role": "... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... |
[
{
"role": "user",
"content": "Show me each generic_name and the number of medications with that generic_name, sorted by the highest count first."
},
{
"role": "assistant",
"content": "SELECT generic_name, COUNT(*) AS medication_count FROM healthcare.medications GROUP BY generic_name ORDER BY med... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd... |
[
{
"role": "user",
"content": "Show all payments made for reservations that had more than 2 adults. Include the payment ID, amount, currency, reservation ID, guest full name, and the number of adults in the reservation."
},
{
"role": "assistant",
"content": "SELECT T1.payment_id, T1.amount, T1.cu... | You are an SQL statement expert. Given the table 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": "How many distinct relationships are listed for policy beneficiaries?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT relationship) FROM insurance.policy_beneficiaries;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, la... |
[
{
"role": "user",
"content": "Show me all invoices where the notes field is not null. Display invoice number, client ID, and notes."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, notes FROM legal_services.invoices WHERE notes IS NOT NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date... |
[
{
"role": "user",
"content": "Please list the contact phone number and website for each insurance plan."
},
{
"role": "assistant",
"content": "SELECT plan_id, plan_name, contact_phone, website FROM healthcare.insurance_plans;"
},
{
"role": "user",
"content": "Show only the plans wher... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.insurance_plans ( plan_id text, plan_name text, insurance_provider text, plan_type text, contact_phone text,... |
[
{
"role": "user",
"content": "Count the number of approval events in erc20_approval for each contract_address between block_number 1000000 and 2000000."
},
{
"role": "assistant",
"content": "SELECT\n contract_address,\n COUNT(*) AS approval_count\nFROM erc20_approval\nWHERE block_number BETWEE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List the token symbol and name for all tokens whose associated contract address has emitted at least one event. Also include the contract address."
},
{
"role": "assistant",
"content": "SELECT T.token_symbol, T.token_name, T.contract_address FROM web3.tokens AS T JO... | You are an SQL statement expert. Given the table 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.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for the token
contract_address cha... |
[
{
"role": "user",
"content": "List all pairs of customers residing in the same city. Show both customer_ids, their full names, and the city."
},
{
"role": "assistant",
"content": "SELECT a.customer_id AS customer_a, a.first_name || ' ' || a.last_name AS name_a, b.customer_id AS customer_b, b.fir... | You are an SQL statement expert. Given the table 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": "Retrieve the service name and the count of applications currently in 'Under Review' status for each service."
},
{
"role": "assistant",
"content": "SELECT s.service_name, COUNT(a.application_id) AS under_review_count\nFROM government_services.services s\nLEFT JOIN 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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "Find all metadata entries where the key is 'issuer' and show their asset_id and value."
},
{
"role": "assistant",
"content": "SELECT asset_id, value FROM trading_platform.metadata WHERE key = 'issuer';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text, user_id text, wallet_id text, asset_id text, order_type text, quantity numeric... |
[
{
"role": "user",
"content": "List each case_id along with entry_id pairs where one entry is billable and the other is non-billable for the same case."
},
{
"role": "assistant",
"content": "SELECT\n te1.case_id,\n te1.entry_id AS billable_entry,\n te2.entry_id AS non_billable_entry\nFROM lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique identifier for the time entry
... |
[
{
"role": "user",
"content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a security_type of 'Equity'."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, security_name FROM financial_services.securities WH... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "Could you show each in-game item's name, its rarity, and the total quantity acquired by all players?"
},
{
"role": "assistant",
"content": "SELECT i.item_name, i.rarity, SUM(pi.quantity) AS total_quantity\nFROM gaming_technology.in_game_items i\nJOIN gaming_technolo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date... |
[
{
"role": "user",
"content": "Show prescriptions with their corresponding chief complaint from the medical record. Return prescription_id, record_id, and chief_complaint."
},
{
"role": "assistant",
"content": "SELECT p.prescription_id, p.record_id, mr.chief_complaint\nFROM healthcare.prescriptio... | You are an SQL statement expert. Given the table 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": "Could you list each game title along with its developer's name and the total number of servers hosting it?"
},
{
"role": "assistant",
"content": "SELECT g.title, d.name AS developer_name, COUNT(s.server_id) AS server_count\nFROM gaming_technology.games g\nLEFT JOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date... |
[
{
"role": "user",
"content": "For each server, show it alongside another server in the same region that has the closest number of current players."
},
{
"role": "assistant",
"content": "SELECT\n s1.server_id AS server_a_id,\n s1.server_name AS server_a_name,\n s2.server_id AS server_b_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara... |
[
{
"role": "user",
"content": "List the usernames of users that are being followed by user 'U123'."
},
{
"role": "assistant",
"content": "SELECT T2.username FROM social_media.follows AS T1 JOIN social_media.users AS T2 ON T1.following_user_id = T2.user_id WHERE T1.follower_user_id = 'U123'"
},
... | You are an SQL statement expert. Given the table 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 route, show the route number and the total number of bookings."
},
{
"role": "assistant",
"content": "SELECT r.route_number, COUNT(b.booking_id) FROM transportation.routes r JOIN transportation.trips t ON r.route_id = t.route_id JOIN transportation.bookings... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "List consecutive fueling events for each vehicle where the refill quantity increased compared to the previous event. Include vehicle_id, previous timestamp and quantity, current timestamp and quantity."
},
{
"role": "assistant",
"content": "SELECT\n prev.vehicle_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 transportation.fuel_logs (
fuel_log_id character varying(64) NOT NULL, -- unique identifier for the fuel log entry... |
[
{
"role": "user",
"content": "Show me all spa service orders (service_id LIKE 'SPA%') in the last month with their guest names and total prices, ordered by total price in descending order."
},
{
"role": "assistant",
"content": "SELECT so.order_id, g.first_name, g.last_name, so.total_price FROM h... | You are an SQL statement expert. Given the table 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 pairs of patients and doctors who are linked by a prescription, listing the patient's full name and the doctor's full name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT\n p.first_name AS patient_first_name,\n p.last_name AS patient_last_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Show each agency along with its parent agency’s name and jurisdiction level."
},
{
"role": "assistant",
"content": "SELECT child.agency_id, child.agency_name, child.jurisdiction_level, parent.agency_name AS parent_agency_name, parent.jurisdiction_level AS parent_jur... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "Find pairs of games released on the same date but by different publishers. Show g1.title, g2.title, g1.publisher_id, g2.publisher_id, and the shared release_date."
},
{
"role": "assistant",
"content": "SELECT g1.title AS game1, g2.title AS game2, g1.publisher_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 gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "Which staff members are managing properties, and what are the names and email addresses of those properties?"
},
{
"role": "assistant",
"content": "SELECT s.staff_id, s.first_name, s.last_name, p.property_name, p.email_address FROM hospitality_technology.staff s INN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "What is the average estimated_loss for claims with status 'Filed' or 'Approved'?"
},
{
"role": "assistant",
"content": "SELECT AVG(estimated_loss) AS avg_estimated_loss\nFROM insurance.claims\nWHERE status IN ('Filed', 'Approved');"
}
] | You are an SQL statement expert. Given the table 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, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "Show me all active insurance products that have a base premium less than $100, sorted by product type."
},
{
"role": "assistant",
"content": "SELECT * FROM insurance.insurance_products WHERE is_active = true AND base_premium < 100 ORDER BY product_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": "How many services are defined for each service category?"
},
{
"role": "assistant",
"content": "SELECT category, COUNT(*) AS service_count FROM government_services.services GROUP BY category;"
},
{
"role": "user",
"content": "Only show categories that ha... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show me all patients who have scheduled appointments with doctors specializing in Cardiology, along with their appointment times and the doctors' full names."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, d... | You are an SQL statement expert. Given the table 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": "I need a list of all documents associated with claims, showing the document ID, file name, document type, and the status of the claim it belongs to."
},
{
"role": "assistant",
"content": "SELECT\n cd.document_id,\n cd.file_name,\n cd.document_type,\n c.status AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "Show me all patients who have scheduled appointments with doctors specializing in Cardiology, along with their appointment times and the doctors' full names."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, a.appointment_time, CONCAT(d.first_... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "What are the top 3 narratives by average USD purchase value per address (for buy transactions) across all chains?"
},
{
"role": "assistant",
"content": "SELECT narrative, AVG(usd_value::float / NULLIF(address_amount,0)) AS avg_usd_per_address\nFROM smart_money_token... | You are an SQL statement expert. Given the table 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": "List each payment method with the total payment amount and the latest payment_timestamp for that method."
},
{
"role": "assistant",
"content": "SELECT payment_method, SUM(amount) AS total_amount, MAX(payment_timestamp) AS latest_payment\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.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu... |
[
{
"role": "user",
"content": "Generate a report that lists each manager’s full name and the count of direct reports they have."
},
{
"role": "assistant",
"content": "SELECT m.employee_id,\n m.first_name || ' ' || m.last_name AS manager_name,\n COUNT(e.employee_id) AS direct_repo... | You are an SQL statement expert. Given the table 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": "Find all pairs of policies for the same customer where their coverage periods overlap. Return customer_id, the two policy numbers, and their start and end dates."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_number AS policy_number1... | You are an SQL statement expert. Given the table 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": "Can you list the names of agencies that do not have a parent agency assigned, ordered by their established date?"
},
{
"role": "assistant",
"content": "SELECT agency_id, agency_name, established_date\nFROM government_services.agencies\nWHERE parent_agency_id IS NULL... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m... |
[
{
"role": "user",
"content": "List all applications that have at least one document with a verification status of 'Verified'. Show the application reference number and the name of the service associated with the application."
},
{
"role": "assistant",
"content": "SELECT\n T1.reference_number,\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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show me all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and belong to the 'Technology' sector, along with their last_updated timestamp."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, securi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text, ticker_symbol text, isin_code text, cusip_code text, security_name te... |
[
{
"role": "user",
"content": "Show the booking ID, first and last name of the passenger, and the status of each booking."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, p.first_name, p.last_name, b.status\nFROM transportation.bookings b\nJOIN transportation.passengers p ON b.passenge... | You are an SQL statement expert. Given the table 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": "Could you show me the total payment amount for each guest, including their first and last names?"
},
{
"role": "assistant",
"content": "SELECT g.guest_id,\n g.first_name,\n g.last_name,\n SUM(p.amount) AS total_paid\nFROM hospitality_technology.gue... | You are an SQL statement expert. Given the table 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": "List all ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "Find customers who made premium payments using both 'credit card' and 'bank transfer' in 2023. Show customer_id."
},
{
"role": "assistant",
"content": "SELECT DISTINCT p1.customer_id\nFROM insurance.premium_payments p1\nJOIN insurance.premium_payments p2\n ON p1.cu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id.text, policy_id.text, customer_id.text, payment_date.timestamp, amount_paid.num... |
[
{
"role": "user",
"content": "For each token, show the token_id and the total number of unique addresses that have ever received it."
},
{
"role": "assistant",
"content": "SELECT token_id, COUNT(DISTINCT to_address) AS unique_recipients\nFROM web3.token_transfers\nGROUP BY token_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.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "I need a report showing the count of servers grouped by their status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS server_count\nFROM gaming_technology.servers\nGROUP BY status;"
},
{
"role": "user",
"content": "Actually, can you als... | You are an SQL statement expert. Given the table 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.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara... |
[
{
"role": "user",
"content": "Count the number of registered citizens by gender."
},
{
"role": "assistant",
"content": "SELECT\n gender,\n COUNT(*) AS citizen_count\nFROM government_services.citizens\nGROUP BY gender;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "Show me the number of service orders placed for each service category."
},
{
"role": "assistant",
"content": "SELECT s.category, COUNT(so.order_id) AS order_count\nFROM hospitality_technology.service_orders so\nJOIN hospitality_technology.services s ON so.service_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "How many users have a non-empty bio field?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.users WHERE bio IS NOT NULL AND bio <> '';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List the user IDs of users who are following user 'U300' and have also created a public post, showing their follower_user_id and the post_id."
},
{
"role": "assistant",
"content": "SELECT T1.follower_user_id, T2.post_id FROM social_media.follows AS T1 JOIN social_me... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u... |
[
{
"role": "user",
"content": "List the trip ID, scheduled departure time, route number, and route type for all trips."
},
{
"role": "assistant",
"content": "SELECT T1.trip_id, T1.scheduled_departure, T2.route_number, T2.type FROM transportation.trips AS T1 JOIN transportation.routes AS T2 ON T1.... | You are an SQL statement expert. Given the table 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": "Show me all unique bed types available across different properties along with their base rates."
},
{
"role": "assistant",
"content": "SELECT DISTINCT bed_type, base_rate, property_id FROM hospitality_technology.room_types;"
},
{
"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 hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu... |
[
{
"role": "user",
"content": "Show the usernames of players and a count of how many different item types they have in their inventory."
},
{
"role": "assistant",
"content": "SELECT T1.username, count(DISTINCT T3.item_type) FROM gaming_technology.players AS T1 JOIN gaming_technology.player_invent... | You are an SQL statement expert. Given the table 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, username text, email text, password_hash text, registration_date timestamp ... |
[
{
"role": "user",
"content": "List all loans (loan_id, loan_type, principal_amount) that have a current principal balance less than 25% of the original principal amount, along with their account_id and the difference between principal_amount and current_principal_balance."
},
{
"role": "assistant",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b... |
[
{
"role": "user",
"content": "For product types that have both active and inactive products, list each pair of product IDs along with the shared product_type and their is_active statuses."
},
{
"role": "assistant",
"content": "SELECT p1.product_id AS active_id, p2.product_id AS inactive_id, p1.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.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "Show me all customers who have missing contact information (either phone number or email is null), along with their state and city."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone_number IS NULL 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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Show me all passengers who have made more than 3 bookings, along with their total fare spent and booking count."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id, p.first_name, p.last_name, COUNT(b.booking_id) AS booking_count, SUM(b.fare) AS total_fare F... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"role": "user",
"content": "List the payment_id, amount, payment_timestamp, and room_number for all payments in USD."
},
{
"role": "assistant",
"content": "SELECT p.payment_id, p.amount, p.payment_timestamp, r.room_number\nFROM hospitality_technology.payments p\nJOIN hospitality_technology.roo... | You are an SQL statement expert. Given the table 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": "List all patients who have active primary insurance plans with expiration dates within the next 60 days, including their policy numbers and subscriber names."
},
{
"role": "assistant",
"content": "SELECT pi.patient_id, pi.policy_number, pi.subscriber_name FROM healt... | You are an SQL statement expert. Given the table 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 all smart money addresses that made over $500,000 profit in the last month, including their chain and last trade time."
},
{
"role": "assistant",
"content": "SELECT address, chain, last_trade_time FROM smart_money_profit WHERE profit > 500000 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 smart_money_profit ( address character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres... |
[
{
"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": "List all employees who have a termination_date set, including their full name, department, and termination_date."
},
{
"role": "assistant",
"content": "SELECT employee_id, first_name || ' ' || last_name AS full_name, department, termination_date FROM financial_servi... | You are an SQL statement expert. Given the table 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.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the employee
... |
[
{
"role": "user",
"content": "For each developer, find the next developer in the same country founded after them, and show both names and their founded years."
},
{
"role": "assistant",
"content": "SELECT d1.name AS developer,\n d1.founded_year,\n (SELECT d2.name\n FROM gaming... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "Show me all maintenance logs for vehicles assigned to depots in 'Los Angeles'. For each log, list the log_id, vehicle_id, service_date, and depot name."
},
{
"role": "assistant",
"content": "SELECT ml.log_id, ml.vehicle_id, ml.service_date, loc.name AS depot_name\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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "Show me the username and email of users who own wallets with private keys starting with '0x1', along with the count of wallets they own."
},
{
"role": "assistant",
"content": "SELECT u.username, u.email, COUNT(w.wallet_id) AS wallet_count FROM blockchain.users u JOI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks (
block_id character varying(64) NOT NULL, -- unique identifier for the block
previous_block... |
[
{
"role": "user",
"content": "Find pairs of customers who share the same last name and live in the same city. List the two customer IDs as customer1_id, customer2_id, their first names as first_name1, first_name2, and city."
},
{
"role": "assistant",
"content": "SELECT c1.customer_id AS customer... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all users who had their KYC status changed from approved to rejected, along with the timestamps of both audits."
},
{
"role": "assistant",
"content": "WITH status_changes AS (SELECT a.user_id, a.status as old_status, b.status as new_status, a.reviewed_at as old... | You are an SQL statement expert. Given the table 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.kyc_audit (
kyc_audit_id character varying(64) NOT NULL, -- unique identifier for the KYC audit
... |
[
{
"role": "user",
"content": "List each service category and the count of services that are currently available."
},
{
"role": "assistant",
"content": "SELECT category,\n COUNT(*) AS available_service_count\nFROM hospitality_technology.services\nWHERE is_available = TRUE\nGROUP BY category... | You are an SQL statement expert. Given the table 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 all patients who have scheduled appointments with cardiology doctors, along with their appointment times and reasons."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, a.reason FROM healthcare.patients... | You are an SQL statement expert. Given the table 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 me the number of employees in each job title and department, for only employees whose status is 'Active'."
},
{
"role": "assistant",
"content": "SELECT job_title, department, COUNT(employee_id) AS employee_count\nFROM financial_services.employees\nWHERE status ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text, ticker_symbol text, isin_code text, cusip_code text, security_name te... |
[
{
"role": "user",
"content": "List all passengers who have never made a booking, showing their passenger_id, first_name, last_name, and email."
},
{
"role": "assistant",
"content": "SELECT\n p.passenger_id,\n p.first_name,\n p.last_name,\n p.email\nFROM transportation.passengers p\nL... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "For each property, show the count of reservations per month in 2024 and the average length of stay in days."
},
{
"role": "assistant",
"content": "SELECT property_id,\n DATE_TRUNC('month', check_in_date)::date AS month,\n COUNT(*) AS reservation_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": "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": "List each partner lawyer's first_name, last_name along with the count of invoices for the cases they lead."
},
{
"role": "assistant",
"content": "SELECT l.lawyer_id, l.first_name, l.last_name, COUNT(i.invoice_id) AS invoice_count\nFROM legal_services.lawyers l\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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show each customer's checking and savings account numbers for customers who have both types."
},
{
"role": "assistant",
"content": "SELECT a.customer_id,\n a.account_number AS checking_account,\n b.account_number AS savings_account\nFROM financial_servic... | You are an SQL statement expert. Given the table 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": "List all ERC20 tokens where the total supply is less than 100,000, including their names and symbols."
},
{
"role": "assistant",
"content": "SELECT name, symbol, total_supply FROM token_metas WHERE is_erc20 = 1 AND CAST(total_supply AS decimal) < 100000;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "For each vehicle, retrieve the date of its most recent maintenance service and the date of its last completed trip."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id,\n ml.max_service_date,\n tr.max_trip_date\nFROM transportation.vehicles v\nLEF... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "List group conversation names created after 2024-01-01 with the count of verified participants in each group."
},
{
"role": "assistant",
"content": "SELECT c.group_name, COUNT(cp.user_id) AS verified_count\nFROM social_media.conversations c\nJOIN social_media.conver... | You are an SQL statement expert. Given the table 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 group chat, list its ID, name, creation time, and the creation time of the next group chat created after it, ordered by creation time."
},
{
"role": "assistant",
"content": "SELECT conversation_id, group_name, created_at, LEAD(created_at) OVER (ORDER BY cre... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR... |
[
{
"role": "user",
"content": "Show all peers whose last_seen timestamp is before '2023-01-01' and whose port number is less than 1000, listing their peer_id and ip_address."
},
{
"role": "assistant",
"content": "SELECT peer_id, ip_address FROM trading_platform.peers WHERE last_seen < '2023-01-01... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.peers ( peer_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port intege... |
[
{
"role": "user",
"content": "For each user, show their user ID and the count of unique wallet addresses they own."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(DISTINCT address) FROM wallets 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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "Which servers are currently offline, and how many players could they host if all were full? Please show the server name, region, and max_players."
},
{
"role": "assistant",
"content": "SELECT server_name, region, max_players\nFROM gaming_technology.servers\nWHERE st... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,... |
[
{
"role": "user",
"content": "List each customer along with the count of other customers living in the same city. Include customer_id, first_name, last_name, city, and other_customer_count."
},
{
"role": "assistant",
"content": "SELECT a.customer_id,\n a.first_name,\n a.last_name,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Find all wallets that have more than 10 unspent UTXOs, along with their user's email and creation date."
},
{
"role": "assistant",
"content": "SELECT w.address, u.email, w.created_at, COUNT(ut.utxo_id) AS unspent_count FROM trading_platform.wallets w JOIN trading_pl... | You are an SQL statement expert. Given the table 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": "Provide the route_number, description, origin location name, and destination location name for all routes of type 'Express'."
},
{
"role": "assistant",
"content": "SELECT r.route_number,\n r.description,\n o.name AS origin_name,\n d.name AS destina... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "List all contracts and the number of different tokens associated with each contract address. Show contract_id, contract address, and token_count."
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address, COUNT(DISTINCT t.token_id) AS token_count\nFROM ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "Find all pairs of drivers who share the same status. Include both driver_ids, full names, and the shared status."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id, d1.first_name || ' ' || d1.last_name AS driver1_name, d2.driver_id AS driver2_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "Show me all active agents who were hired in the last 2 years, along with their agency names and commission rates, sorted by hire date in descending order."
},
{
"role": "assistant",
"content": "SELECT agent_id, first_name, last_name, agency_name, commission_rate, hi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
[
{
"role": "user",
"content": "For each user, 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": "Show me all guests who have not provided communication consent, including their email addresses and loyalty member IDs."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email, loyalty_member_id\nFROM hospitality_technology.guests\nWHERE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "Show me all notifications where the target entity type is 'comment', and for each notification, include the content of the corresponding comment."
},
{
"role": "assistant",
"content": "SELECT n.*, c.content AS comment_content FROM social_media.notifications n 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.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "Show me a list of all doctors who have made at least one diagnosis along with the total number of diagnoses they have made."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(di.diagnosis_id) AS diagnosis_count\nFROM healthca... | You are an SQL statement expert. Given the table 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, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.