system stringlengths 280 8.23k | conversations listlengths 2 8 |
|---|---|
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades (
trade_id character varying(64) NOT NULL, -- unique identifier for the trade
account... | [
{
"role": "user",
"content": "Show me all trades for account 'ACC654321' executed after January 1, 2024."
},
{
"role": "assistant",
"content": "SELECT *\nFROM financial_services.trades\nWHERE account_id = 'ACC654321' AND trade_timestamp > '2024-01-01';"
},
{
"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.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... | [
{
"role": "user",
"content": "List all rooms that are currently in 'Maintenance' status, including their room numbers and current conditions."
},
{
"role": "assistant",
"content": "SELECT room_number, current_condition FROM hospitality_technology.rooms WHERE status = 'Maintenance';"
},
{
... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... | [
{
"role": "user",
"content": "Show me all wallets holding SUI coins with a balance greater than 2,000,000. Include the coin_type, balance, and owner address."
},
{
"role": "assistant",
"content": "SELECT coin_type, balance, owner FROM sui_coins WHERE status = 'exists' AND CAST(balance AS bigint)... |
You are an SQL statement expert. Given the table 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 a list of all fuel refueling events for each trip, including the trip ID, fuel type, quantity, total cost, and the name of the refueling location."
},
{
"role": "assistant",
"content": "SELECT fl.trip_id, fl.fuel_type, fl.quantity, fl.total_cost, 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 trading_platform.kyc_audit (
kyc_audit_id character varying(64) NOT NULL, -- unique identifier for the KYC audit
... | [
{
"role": "user",
"content": "Show me all KYC audit records for user ID 'user_abc_123'."
},
{
"role": "assistant",
"content": "SELECT kyc_audit_id, user_id, status, reviewed_at FROM kyc_audit WHERE user_id = 'user_abc_123';"
},
{
"role": "user",
"content": "From those, list only the ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NO... | [
{
"role": "user",
"content": "List each patient_id along with the policy_number of their primary plan and the policy_number of any secondary (non-primary) plan they hold."
},
{
"role": "assistant",
"content": "SELECT p_primary.patient_id,\n p_primary.policy_number AS primary_policy,\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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... | [
{
"role": "user",
"content": "Show the wallet ID, user's username, and the creator address for all wallets whose address was used to deploy a smart contract."
},
{
"role": "assistant",
"content": "SELECT w.wallet_id, u.username, sc.creator_address\nFROM blockchain.wallets w\nJOIN blockchain.user... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services (
service_id character varying(64) NOT NULL, -- unique identifier for the service
... | [
{
"role": "user",
"content": "Count the total number of services that have an average processing time greater than 10 days and are currently active."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM government_services.services WHERE average_processing_time_days > 10 AND is_active = 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 gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... | [
{
"role": "user",
"content": "Which games have the highest number of different in-game items of type 'Weapon'? Show the game title and the count."
},
{
"role": "assistant",
"content": "SELECT g.title AS game_title, COUNT(*) AS weapon_count\nFROM gaming_technology.in_game_items i\nJOIN 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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... | [
{
"role": "user",
"content": "What are the top 5 tokens by net_flow in smart_money_token_performance along with their chain and ROI?"
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, net_flow, roi FROM smart_money_token_performance ORDER BY net_flow DESC LIMIT 5;"
},
{
"... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... | [
{
"role": "user",
"content": "List the content and comment ID for all comments made by users with private profiles."
},
{
"role": "assistant",
"content": "SELECT c.comment_id, c.content FROM social_media.comments AS c JOIN social_media.user_settings AS us ON c.user_id = us.user_id WHERE us.priva... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... | [
{
"role": "user",
"content": "For the 'AI' and 'Gaming' narratives, what is the total USD value held by CEXes for tokens listed in their top 3 coins?"
},
{
"role": "assistant",
"content": "SELECT T2.narrative, SUM(T1.usd_value) AS TotalCexUSDValue FROM cex_token_balance AS T1 JOIN narrative_info... |
You are an SQL statement expert. Given the table 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 to find patients who received prescriptions within 7 days after their latest appointment. Show patient_id, first and last name, appointment_time, prescription_date, and medication_name."
},
{
"role": "assistant",
"content": "WITH latest_appt AS (\n SELECT 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... | [
{
"role": "user",
"content": "How many patients are there for each gender?"
},
{
"role": "assistant",
"content": "SELECT gender, COUNT(*) AS patient_count\nFROM healthcare.patients\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 gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,... | [
{
"role": "user",
"content": "Show me all servers that have the same current_players value as another server in a different region. List both server names, their regions, and the current_players value."
},
{
"role": "assistant",
"content": "SELECT s1.server_name AS server1, s1.region AS region1,... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... | [
{
"role": "user",
"content": "For each patient, find the next appointment after each one. Return patient_id, appointment_id AS current_appointment, next_appointment_id, and waiting_time in minutes."
},
{
"role": "assistant",
"content": "SELECT a.patient_id,\n a.appointment_id AS current_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 character varying(64) NOT NULL, -- unique identifier for the citizen
... | [
{
"role": "user",
"content": "For each agency, show the name and the number of distinct document types that have been submitted for applications of services they provide."
},
{
"role": "assistant",
"content": "SELECT ag.agency_name, COUNT(DISTINCT d.document_type) AS document_type_count\nFROM 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.agencies ( agency_id text, agency_name text, jurisdiction_level text, primary_contact_email text, m... | [
{
"role": "user",
"content": "Show the names of all agencies and the names of their associated service locations."
},
{
"role": "assistant",
"content": "SELECT T1.agency_name , T2.location_name FROM government_services.agencies AS T1 JOIN government_services.service_locations AS T2 ON T1.agency... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... | [
{
"role": "user",
"content": "Show me the count of available rooms for each property."
},
{
"role": "assistant",
"content": "SELECT T1.property_name, count(T2.room_id) FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.rooms AS T2 ON T1.property_id = T2.property_id WHERE T2... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, trip_... | [
{
"role": "user",
"content": "Find all pairs of fuel log entries for the same vehicle that occurred on the same calendar day. Show vehicle ID, the two log IDs, and their timestamps."
},
{
"role": "assistant",
"content": "SELECT\n f1.vehicle_id,\n f1.fuel_log_id AS log_id_1,\n f2.fuel_lo... |
You are an SQL statement expert. Given the table 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": "Show me each user's username, their wallet address, and the total quantity of open orders they have placed, along with the name of the asset for each order."
},
{
"role": "assistant",
"content": "SELECT u.username, w.address, o.asset_id, SUM(o.quantity) AS total_ope... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE narrative_info (",
"narrative character varying(512) NOT NULL, -- the id of narrative",
"top_3_coins text, --... | [
{
"role": "user",
"content": "List the top 3 narratives by 7-day price change percentage from the narrative_info table."
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_7d\nFROM narrative_info\nORDER BY price_change_percentage_7d DESC\nLIMIT 3;"
},
{
"role... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_achievements (
player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id... | [
{
"role": "user",
"content": "Calculate for each player the timespan between their earliest and latest achievement unlocks."
},
{
"role": "assistant",
"content": "SELECT pa_min.player_id,\n pa_max.max_time - pa_min.min_time AS span\nFROM (\n SELECT player_id,\n MIN(unlocked_at) AS... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... | [
{
"role": "user",
"content": "Show conversations that are group chats and have more than 5 participants. List the conversation_id and group_name."
},
{
"role": "assistant",
"content": "SELECT c.conversation_id, c.group_name FROM social_media.conversations AS c JOIN social_media.conversation_part... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t... | [
{
"role": "user",
"content": "How many notifications have been sent for comments in total?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*)\nFROM social_media.notifications\nWHERE target_entity_type = 'comment';"
}
] |
You are an SQL statement expert. Given the table 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": "Show all patient insurance records including the policy number, effective date, and the name of the associated insurance plan."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T1.effective_date, T2.plan_name FROM healthcare.patient_insurance AS T1 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... | [
{
"role": "user",
"content": "List all NFT holdings from the `nft_holders` table where the `contract_type` is 'ERC721'. Show the wallet address, contract address, token ID, and amount held."
},
{
"role": "assistant",
"content": "SELECT wallet_address, contract_address, token_id, CAST(amount AS 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 gaming_technology.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... | [
{
"role": "user",
"content": "Can you show me the average session duration and total score for each server and game combination?"
},
{
"role": "assistant",
"content": "SELECT server_id, game_id, AVG(duration_seconds) AS avg_duration, SUM(score) AS total_score FROM gaming_technology.game_sessions... |
You are an SQL statement expert. Given the table 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 wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount."
},
{
"role": "assistant",
"content": "SELECT eb.wallet_address, tm.symbol, eb.amount FROM erc20_balances eb JOIN token_metas tm ON eb.contract_address = tm... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id text PRIMARY KEY, firm_name text, address text, phone text, website text, founded_da... | [
{
"role": "user",
"content": "List all law firms whose website is missing or not provided."
},
{
"role": "assistant",
"content": "SELECT firm_id, firm_name, address, phone, founded_date, managing_partner_id\nFROM legal_services.law_firms\nWHERE website IS NULL OR website = '';"
}
] |
You are an SQL statement expert. Given the table 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": "List employees whose transaction effective_date matches their hire_date anniversary. Show full name and count of such transactions."
},
{
"role": "assistant",
"content": "SELECT e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n COUN... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... | [
{
"role": "user",
"content": "List all claims, including the claim ID, incident date, estimated loss, and the name of the insurance product associated with the policy under which the claim was made."
},
{
"role": "assistant",
"content": "SELECT\n c.claim_id,\n c.incident_date,\n c.estimated_l... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... | [
{
"role": "user",
"content": "Find the total payment amount and payment count made by citizen with national ID number 'A123456789'."
},
{
"role": "assistant",
"content": "SELECT SUM(p.amount) AS total_amount, COUNT(p.payment_id) AS payment_count\nFROM government_services.citizens c\nJOIN governm... |
You are an SQL statement expert. Given the table 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": "Could you list each developer along with the next developer founded after them in the same country? Return columns current_developer, next_developer, and years_difference."
},
{
"role": "assistant",
"content": "SELECT d1.name AS current_developer,\n d2.name 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 web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... | [
{
"role": "user",
"content": "List all pairs of token transfers where the sender is the same but the recipients differ. Show both transfer IDs and the common sender address."
},
{
"role": "assistant",
"content": "SELECT t1.transfer_id AS transfer_id_1, t2.transfer_id AS transfer_id_2, t1.from_ad... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... | [
{
"role": "user",
"content": "Show me the first and last names of all customers who have filed a claim, along with the claim ID and incident date."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, cl.claim_id, cl.incident_date\nFROM insurance.customers c\nJOIN insurance.cl... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.appointments ( appointment_id character varying(64) NOT NULL, client_id character varying(64) NOT NULL, ... | [
{
"role": "user",
"content": "Show me the subject and start times of all appointments along with the corresponding lawyer IDs for each client."
},
{
"role": "assistant",
"content": "SELECT client_id, lawyer_id, subject, start_time FROM legal_services.appointments;"
}
] |
You are an SQL statement expert. Given the table 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, customer_id character varying(64) NOT NULL, product_id c... | [
{
"role": "user",
"content": "I need to identify customers who have two different policies that have overlapping coverage periods. List the customer_id along with the two policy_ids."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_id,\n p2.poli... |
You are an SQL statement expert. Given the table 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": "Show me all wallet addresses that hold more than 100 of any ERC1155 token, along with the token ID and amount."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, amount FROM erc20_balances WHERE CAST(amount AS decimal) > 100 AND contract_address... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... | [
{
"role": "user",
"content": "Could you please provide a list of patients along with the total count of chronic diagnoses they have received? Show the patient's ID, first name, last name, and the count."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, COUNT(... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... | [
{
"role": "user",
"content": "Can you list all the policy numbers and their group_numbers for policies that will expire within the next 90 days from today?"
},
{
"role": "assistant",
"content": "SELECT policy_number, group_number FROM healthcare.patient_insurance WHERE expiration_date BETWEEN 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 legal_services.cases ( case_id text PRIMARY KEY, case_number text UNIQUE, case_name text, client_id text, lead_lawyer_i... | [
{
"role": "user",
"content": "Retrieve all billable but not yet billed time entries, showing entry_id, lawyer_id, case_id, hours_spent, and billing_rate."
},
{
"role": "assistant",
"content": "SELECT entry_id, lawyer_id, case_id, hours_spent, billing_rate\nFROM legal_services.time_entries\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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... | [
{
"role": "user",
"content": "Show me all patients who have received at least two different medications prescribed by doctors working at the same hospital. Include the patient full name, the medication names, and the shared hospital_affiliation_id."
},
{
"role": "assistant",
"content": "SELECT 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 legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date... | [
{
"role": "user",
"content": "Which clients have appointments scheduled for a case that also has at least one invoice issued? Please show the client_id, appointment_id, appointment start_time, related case_id, and invoice_number."
},
{
"role": "assistant",
"content": "SELECT a.client_id, a.appoi... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.notifications ( notification_id text, citizen_id text, application_id text, message_subject text, m... | [
{
"role": "user",
"content": "Provide a count of notifications grouped by their related entity type."
},
{
"role": "assistant",
"content": "SELECT related_entity_type, COUNT(*) FROM government_services.notifications GROUP BY related_entity_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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... | [
{
"role": "user",
"content": "List each client_id, first_name, last_name, and the sum of total_amount for all of their invoices."
},
{
"role": "assistant",
"content": "SELECT c.client_id,\n c.first_name,\n c.last_name,\n SUM(i.total_amount) AS total_invoiced\nFROM legal_service... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... | [
{
"role": "user",
"content": "List all doctors who have a hospital affiliation and include their specialty and affiliation ID."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, specialty, hospital_affiliation_id FROM healthcare.doctors WHERE hospital_affiliation_id IS NOT NULL... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego... | [
{
"role": "user",
"content": "Show the service names that had documents uploaded for their applications in the calendar year 2023."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.service_name FROM government_services.services AS T1 JOIN applications AS T2 ON T1.service_id = T2.service_... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... | [
{
"role": "user",
"content": "Show me service orders and any associated review comments for reservation ID 'RES007'. List the order ID, service ID, quantity, total price from the order, and the review comment if available."
},
{
"role": "assistant",
"content": "SELECT so.order_id, 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... | [
{
"role": "user",
"content": "List the names of service locations and the names of the agencies they belong to, specifically for locations situated in the state of 'Texas' that are marked as accessible."
},
{
"role": "assistant",
"content": "SELECT t1.location_name, t2.agency_name FROM governmen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.