conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Can you show me the total score and number of sessions for each player and each game they played?"
},
{
"role": "assistant",
"content": "SELECT player_id, game_id, COUNT(session_id) AS session_count, SUM(score) AS total_score\nFROM gaming_technology.game_sessions\nG... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions (
session_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the ... |
[
{
"role": "user",
"content": "Show me the total number of trades and the total traded value for each customer, including their first and last names."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name, c.last_name, COUNT(t.trade_id) AS trade_count, SUM(t.total_amount) AS to... | You are an SQL statement expert. Given the table 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": "List all insurance products with a base premium exceeding 500, showing the product name, type, and base premium."
},
{
"role": "assistant",
"content": "SELECT product_name, product_type, base_premium FROM insurance.insurance_products WHERE base_premium > 500;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "I want to know how many vehicles are assigned to each depot_id."
},
{
"role": "assistant",
"content": "SELECT depot_id, COUNT(*) AS vehicle_count FROM transportation.vehicles GROUP BY depot_id;"
},
{
"role": "user",
"content": "Please only include depots... | You are an SQL statement expert. Given the table 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": "Show me all records from the project fundraising table, listing the project name, rounds name, and investment value."
},
{
"role": "assistant",
"content": "SELECT project_name, rounds_name, investment_value FROM project_fundraising_record;"
},
{
"role": "use... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character... |
[
{
"role": "user",
"content": "Which tokens have both buy and sell transactions? Show token_symbol and chain."
},
{
"role": "assistant",
"content": "SELECT DISTINCT i1.token_symbol, i1.chain\nFROM smart_money_token_inflow i1\nJOIN smart_money_token_inflow i2\n ON i1.token_symbol = i2.token_symbo... | You are an SQL statement expert. Given the table 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 text, token_symbol text, token_amount numeric, usd_value numeric, avg_price nu... |
[
{
"role": "user",
"content": "Which customers have more than one active policy at the same time? Show the customer ID and the number of active policies."
},
{
"role": "assistant",
"content": "SELECT customer_id, COUNT(policy_id) AS active_policy_count\nFROM insurance.policies\nWHERE status = 'Ac... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"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 the subject and start time for all appointments that are related to a case that also has an invoice. Include the case number and the invoice number."
},
{
"role": "assistant",
"content": "SELECT T1.subject, T1.start_time, T2.case_number, T3.invoice_number FROM ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad... |
[
{
"role": "user",
"content": "List all agents and their managers' full names."
},
{
"role": "assistant",
"content": "SELECT a.first_name, a.last_name, m.first_name AS manager_first_name, m.last_name AS manager_last_name FROM insurance.agents a LEFT JOIN insurance.agents m ON a.manager_id = m.age... | You are an SQL statement expert. Given the table 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": "Find all metadata entries where the key is 'token_name' and display the asset_id along with its value."
},
{
"role": "assistant",
"content": "SELECT asset_id, value\nFROM trading_platform.metadata\nWHERE key = 'token_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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "List all routes where the origin and destination are in the same state, showing the route_number, state, origin city, destination city, distance_km, and type."
},
{
"role": "assistant",
"content": "SELECT r.route_number, o.state_province AS state, o.city AS origin_c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "Show me the total fare collected from all completed bookings (status = 'completed') grouped by passenger_id."
},
{
"role": "assistant",
"content": "SELECT passenger_id, SUM(fare) AS total_fare FROM transportation.bookings WHERE status = 'completed' GROUP BY 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.bookings ( booking_id text PRIMARY KEY, passenger_id text, trip_id text, seat_number text, booking_time ... |
[
{
"role": "user",
"content": "Retrieve the product_id and product_name for all insurance products created after March 1, 2024."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name\nFROM insurance.insurance_products\nWHERE created_at > '2024-03-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 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 wallet addresses holding the ERC20 token with contract address '0xabcdeffedcba9876543210abcdefedcba9876'. Include the amount they hold."
},
{
"role": "assistant",
"content": "SELECT wallet_address, amount FROM erc20_balances WHERE contract_address = '0xa... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text,... |
[
{
"role": "user",
"content": "Show me the names of law firms and their associated open case numbers."
},
{
"role": "assistant",
"content": "SELECT l.firm_name, c.case_number\nFROM legal_services.law_firms l\nJOIN legal_services.cases c\n ON l.managing_partner_id = c.lead_lawyer_id\nWHERE c.stat... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... |
[
{
"role": "user",
"content": "How many active insurance policies does each patient have? Return patient_id and active_policy_count."
},
{
"role": "assistant",
"content": "SELECT patient_id,\n COUNT(*) AS active_policy_count\nFROM healthcare.patient_insurance\nWHERE expiration_date 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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show me the usernames and full names of all users who have liked at least one post that was created in May 2024."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, u.full_name\nFROM social_media.users u\nJOIN social_media.likes l ON u.user_id = l.use... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Show the number of notifications sent per channel."
},
{
"role": "assistant",
"content": "SELECT channel, COUNT(*) AS notification_count\nFROM government_services.notifications\nGROUP BY channel;"
},
{
"role": "user",
"content": "Filter the result to inc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "For each fundraising round, can you list the total amount invested and the corresponding number of projects in that round, as well as the highest token market cap associated with any project of that round? Please show the round name, total investment, project count, and max tok... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id text, project_id text, project_name text, rounds_name text, investment_value numeric, i... |
[
{
"role": "user",
"content": "Provide a count of locations for each country listed in the table."
},
{
"role": "assistant",
"content": "SELECT country, COUNT(*) FROM transportation.locations GROUP BY country"
}
] | You are an SQL statement expert. Given the table 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": "List the names and prices of all services ordered by guests from 'Texas', along with the guest's full name."
},
{
"role": "assistant",
"content": "SELECT g.first_name, g.last_name, s.service_name, s.price\nFROM hospitality_technology.guests g\nJOIN hospitality_techn... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "Show the earliest scheduled_departure and the latest actual_arrival for each route_id."
},
{
"role": "assistant",
"content": "SELECT route_id, MIN(scheduled_departure) AS earliest_scheduled_departure, MAX(actual_arrival) AS latest_actual_arrival FROM transportation.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id text, route_id text, vehicle_id text, driver_id text, scheduled_departure timestamp, act... |
[
{
"role": "user",
"content": "Show me all premium payments made via credit card in the last 30 days, along with their payment amounts and transaction references."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount_paid, transaction_reference FROM insurance.premium_payments WHERE pay... | You are an SQL statement expert. Given the table 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": "List the full names of customers along with the count of their active policies, but only include those customers with at least 3 active policies."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(p.policy_id) AS active_policy_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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Show the payment ID, amount, and payment method for all payments made in USD with an amount greater than 50."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount, payment_method\nFROM government_services.payments\nWHERE currency = 'USD' AND amount > 50;"... | You are an SQL statement expert. Given the table 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": "List all appointments that have a location specified and their status is not 'Cancelled'. Show the appointment ID, subject, and location."
},
{
"role": "assistant",
"content": "SELECT appointment_id, subject, location FROM legal_services.appointments WHERE location ... | You are an SQL statement expert. Given the table 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 the claim ID, estimated loss, and the corresponding policy number for claims reported in the year 2023."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.estimated_loss, T2.policy_number FROM insurance.claims AS T1 JOIN insurance.policies AS T2 ON T... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"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": "List all premium payments made by Bank Transfer where the amount_paid is greater than 5000. Show payment_id, policy_id, customer_id, amount_paid, and payment_date, ordered by amount_paid descending."
},
{
"role": "assistant",
"content": "SELECT payment_id,\n 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.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "Show me all users who have unread notifications sent more than 3 days ago, along with the notification message and when it was sent."
},
{
"role": "assistant",
"content": "SELECT user_id, message, sent_at FROM trading_platform.notifications WHERE read_at IS NULL AND... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"role": "user",
"content": "List the medication_id, medication_name, and description for all medications whose generic_name starts with 'A'."
},
{
"role": "assistant",
"content": "SELECT medication_id, medication_name, description\nFROM healthcare.medications\nWHERE generic_name LIKE 'A%';"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications (
medication_id character varying(64) NOT NULL, -- unique identifier for the medication type... |
[
{
"role": "user",
"content": "Find pairs of wallet IDs that belong to the same user, showing the user ID and the two wallet IDs."
},
{
"role": "assistant",
"content": "SELECT w1.user_id, w1.wallet_id AS wallet1_id, w2.wallet_id AS wallet2_id FROM web3.wallets w1 JOIN web3.wallets w2 ON w1.user_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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Provide a count of cases for each case type."
},
{
"role": "assistant",
"content": "SELECT case_type, count(*) FROM legal_services.cases GROUP BY case_type"
},
{
"role": "user",
"content": "Only include counts for 'Civil Litigation' and 'Criminal Defense... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t... |
[
{
"role": "user",
"content": "List all metadata keys and their corresponding values for the asset with symbol 'BTC'."
},
{
"role": "assistant",
"content": "SELECT m.key, m.value\nFROM trading_platform.metadata m\nJOIN trading_platform.assets a ON m.asset_id = a.asset_id\nWHERE a.symbol = 'BTC';"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Find, for each case, pairs of documents where one document_type is 'Contract' and the other is 'Evidence'. Return the case_id, the name of the contract document as contract_name, and the name of the evidence document as evidence_name."
},
{
"role": "assistant",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "Show me the total unbilled billable hours per lawyer."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, SUM(hours_spent) AS total_unbilled_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\n AND is_billed = FALSE\nGROUP BY lawyer_id;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Show the total count of appointments for each unique status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) FROM healthcare.appointments GROUP BY status;"
},
{
"role": "user",
"content": "Now, only show the statuses where the count is gre... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "Find employees who were hired after their managers. Display the employee's full name, their hire date, the manager's full name, and the manager's hire date."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS employee_name, e.hire_dat... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "List all insurance products and the total number of premium payments that have been made for each of them. Show product_id, product_name, and payments_count."
},
{
"role": "assistant",
"content": "SELECT ip.product_id, ip.product_name, COUNT(pp.payment_id) AS paymen... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "I want to know the number of agencies established each year by jurisdiction level."
},
{
"role": "assistant",
"content": "SELECT jurisdiction_level, EXTRACT(YEAR FROM established_date) AS year, COUNT(*) AS agency_count\nFROM government_services.agencies\ngroup by ju... | You are an SQL statement expert. Given the table 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": "How many notifications related to services were sent for each service category in the past 7 days?"
},
{
"role": "assistant",
"content": "SELECT\n s.category,\n COUNT(n.notification_id) AS notification_count\nFROM\n government_services.notifications n\n JOIN gov... | You are an SQL statement expert. Given the table 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": "For each doctor, calculate the total duration of all their appointments. Show doctor_id and the sum of duration_minutes."
},
{
"role": "assistant",
"content": "SELECT doctor_id, SUM(duration_minutes) AS total_duration FROM healthcare.appointments GROUP BY doctor_id;... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi... |
[
{
"role": "user",
"content": "Provide the count of transfers for each token_id."
},
{
"role": "assistant",
"content": "SELECT token_id,\n COUNT(*) AS transfer_count\nFROM web3.token_transfers\nGROUP BY token_id;"
},
{
"role": "user",
"content": "Actually, also include the total... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ... |
[
{
"role": "user",
"content": "Can you retrieve a list of all case numbers, their names, the client's full name, and the date_opened, sorted by date_opened descending?"
},
{
"role": "assistant",
"content": "SELECT c.case_number,\n c.case_name,\n CONCAT(cl.first_name, ' ', cl.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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Retrieve the first and last names and email addresses of all customers who registered after '2024-01-01'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM insurance.customers WHERE created_at > '2024-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 insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "Show the usernames of users who have used any hashtag in their posts, along with the tag name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username, T4.tag_name FROM social_media.users AS T1 JOIN posts AS T2 ON T1.user_id = T2.user_id JOIN post_hashtag... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "List each region and the number of servers currently in 'maintenance' status."
},
{
"role": "assistant",
"content": "SELECT region,\n COUNT(*) AS maintenance_count\nFROM gaming_technology.servers\nWHERE status = 'maintenance'\nGROUP BY region;"
},
{
"r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,... |
[
{
"role": "user",
"content": "What is the count of securities for each security_type in the 'Technology' sector?"
},
{
"role": "assistant",
"content": "SELECT security_type, COUNT(*) as security_count FROM financial_services.securities WHERE sector = 'Technology' GROUP BY security_type;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities (
security_id character varying(64) NOT NULL, -- unique identifier for the security
... |
[
{
"role": "user",
"content": "List the top 3 addresses with the highest profit on the Arbitrum chain, including roi and most_profit_token."
},
{
"role": "assistant",
"content": "SELECT address, profit, roi, most_profit_token FROM smart_money_profit WHERE chain = 'Arbitrum' ORDER BY profit DESC 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 smart_money_profit ( address.text, rank.numeric, profit.numeric, roi.numeric, realized_ratio.numeric, most_profit_token... |
[
{
"role": "user",
"content": "List all claims that were reported more than 30 days after the incident date."
},
{
"role": "assistant",
"content": "SELECT claim_id, policy_id, customer_id, incident_date, reported_date FROM insurance.claims WHERE DATEDIFF(reported_date, incident_date) > 30;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"role": "user",
"content": "Find the application IDs for applications that have received notifications through both 'Email' and 'SMS' channels."
},
{
"role": "assistant",
"content": "SELECT application_id FROM government_services.notifications WHERE channel IN ('Email', 'SMS') GROUP BY applica... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m... |
[
{
"role": "user",
"content": "For each city that has a fueling location, show the city name and the total quantity of fuel refueled."
},
{
"role": "assistant",
"content": "SELECT T2.city , SUM(T1.quantity) FROM transportation.fuel_logs AS T1 JOIN transportation.locations AS T2 ON T1.location_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.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p JOIN hosp... | You are an SQL statement expert. Given the table 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": "Can you help me retrieve the list of components made of a specific material along with their supplier details?"
},
{
"role": "assistant",
"content": "SMEMBERS material_components:mat:TI64\nHGETALL component:<component_id>\nHGET component:<component_id> supplier_id"
... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe... |
[
{
"role": "user",
"content": "For each user, list all the distinct actions they have performed along with the count of each action."
},
{
"role": "assistant",
"content": "SELECT user_id, action, COUNT(*) FROM trading_platform.logs GROUP BY user_id, action ORDER BY user_id, action;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.logs ( log_id character varying(64) NOT NULL, user_id character varying(64), action character varying(... |
[
{
"role": "user",
"content": "For each chain, which token has the greatest absolute difference between its 1-hour and 6-hour price change percentage? Show the chain, token symbol, and the absolute difference."
},
{
"role": "assistant",
"content": "SELECT chain, token_symbol, ABS(price_change_per... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE token_dexpool_info (",
"pair_address character varying(512) NOT NULL, -- the id of dexpool",
"token_name cha... |
[
{
"role": "user",
"content": "Which policies have a premium amount greater than the base premium of their respective insurance product? Please show the policy_number, premium_amount, product_name, and base_premium."
},
{
"role": "assistant",
"content": "SELECT p.policy_number, p.premium_amount, ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "How many distinct users have uploaded claim documents of type 'ACCIDENT_REPORT'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT uploaded_by) FROM insurance.claim_documents WHERE document_type = 'ACCIDENT_REPORT';"
}
] | You are an SQL statement expert. Given the table 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": "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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"role": "user",
"content": "Show the full name of citizens and the total amount they have paid for appointments they have scheduled. Only include citizens who have scheduled at least one appointment."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "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": "Retrieve review comments and their overall rating for properties that currently have at least one room with a status of 'Available'. Include the review ID, property ID, and review date."
},
{
"role": "assistant",
"content": "SELECT r.review_id, r.comment, r.rating_o... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "Show me the names and URLs of all DApps where the description contains the word 'wallet'."
},
{
"role": "assistant",
"content": "SELECT name, url FROM trading_platform.dapps WHERE description ILIKE '%wallet%';"
},
{
"role": "user",
"content": "I also wan... | You are an SQL statement expert. Given the table 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.dapps ( dapp_id.text, name.text, description.text, url.text )
|
[
{
"role": "user",
"content": "List pairs of policies for the same customer that have the same premium amount but different coverage limits. Show customer ID, policy ID 1, policy ID 2, the premium amount, and the two coverage limits."
},
{
"role": "assistant",
"content": "SELECT T1.customer_id, T... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "Retrieve each game_id alongside the achievement with the highest points, showing its name and points."
},
{
"role": "assistant",
"content": "SELECT a.game_id,\n a.name,\n a.points\nFROM achievements a\nJOIN (\n SELECT game_id,\n MAX(points) AS m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url t... |
[
{
"role": "user",
"content": "Show all claims and the full name of the customer who filed each claim."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.incident_date, T1.description, T2.first_name, T2.last_name FROM insurance.claims AS T1 JOIN insurance.customers AS T2 ON T1.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 character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Which five companies have the most clients, and how many clients does each have?"
},
{
"role": "assistant",
"content": "SELECT company_name, COUNT(*) AS client_count\nFROM legal_services.clients\nGROUP BY company_name\nORDER BY client_count DESC\nLIMIT 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 legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "List the names of services that have been scheduled at accessible service locations."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.service_name FROM government_services.services AS T1 JOIN government_services.appointments AS T2 ON T1.service_id = T2.serv... | You are an SQL statement expert. Given the table 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 users who share a conversation with user 'user123', listing their user_id and the conversation_id."
},
{
"role": "assistant",
"content": "SELECT DISTINCT cp2.user_id, cp2.conversation_id\nFROM social_media.conversation_participants cp1\nJOIN social_media.co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversation_participants (
participant_id character varying(64) NOT NULL, -- unique identifier for th... |
[
{
"role": "user",
"content": "What is the current salary of employee with ID 'EMP123'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about an employee's salary as it is not included in the data available in the 'employees' table."
}
] | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.employees (
... |
[
{
"role": "user",
"content": "Can you narrow this down to only show cases where the case type is 'Criminal'?"
},
{
"role": "assistant",
"content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Crimin... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t... |
[
{
"role": "user",
"content": "Find the transaction IDs and timestamps for all transactions that resulted from an emitted event."
},
{
"role": "assistant",
"content": "SELECT t.transaction_id, t.timestamp FROM web3.transactions t JOIN web3.events e ON t.transaction_id = e.transaction_id;"
}
] | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_a... |
[
{
"role": "user",
"content": "List all claims along with the corresponding policy number and the full names of all beneficiaries associated with each policy."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, p.policy_number, b.first_name || ' ' || b.last_name AS beneficiary_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "Find all patients who have been prescribed medications (recorded in medical records) along with their chief complaints and the medications mentioned in their treatment plans."
},
{
"role": "assistant",
"content": "SELECT DISTINCT p.patient_id, p.first_name, p.last_n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List all post IDs and their corresponding hashtag names for posts that include media."
},
{
"role": "assistant",
"content": "SELECT ph.post_id, h.tag_name\nFROM social_media.post_hashtags ph\nJOIN social_media.hashtags h ON ph.hashtag_id = h.hashtag_id\nJOIN social_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "Show the scheduled start times and service names for all appointments, along with the description of those services."
},
{
"role": "assistant",
"content": "SELECT a.scheduled_start_time, s.service_name, s.description\nFROM government_services.appointments a\nJOIN 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.services (
service_id character varying(64) NOT NULL, -- unique identifier for the service
... |
[
{
"role": "user",
"content": "List all trades for a given security, showing ticker_symbol, trade_id, account_id, trade_type, and total_amount."
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, t.trade_id, t.account_id, t.trade_type, t.total_amount\nFROM financial_services.trades t\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": "List the medical record ID and record date for all medical records that are linked to an appointment whose duration was longer than the average duration of all appointments."
},
{
"role": "assistant",
"content": "SELECT T1.record_id, T1.record_date FROM healthcare.m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "What is the total amount of the ERC20 token with contract address '0x112233...' held across all wallets?"
},
{
"role": "assistant",
"content": "SELECT SUM(CAST(amount AS DECIMAL)) FROM erc20_balances_historical WHERE contract_address = '0x112233...'"
},
{
"r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "What is the total count of blocks and the average difficulty?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*), AVG(difficulty) FROM blockchain.blocks"
},
{
"role": "user",
"content": "Now, show me the total count and average difficulty only for bl... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp tim... |
[
{
"role": "user",
"content": "List the property_name and the total number of rooms that are designated as smoking rooms for each property."
},
{
"role": "assistant",
"content": "SELECT p.property_name, COUNT(*) AS smoking_room_count\nFROM hospitality_technology.rooms r\nJOIN hospitality_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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Find all route numbers for routes where the distance is exactly equal to the estimated duration in minutes."
},
{
"role": "assistant",
"content": "SELECT route_number\nFROM transportation.routes\nWHERE distance_km = estimated_duration_minutes;"
}
] | You are an SQL statement expert. Given the table 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": "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 all properties located in the USA with a star rating of 4.0 or higher, along with their city and property type."
},
{
"role": "assistant",
"content": "SELECT property_name, city, property_type, star_rating FROM hospitality_technology.properties WHERE country_co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List all achievements (name and ID) that have not been unlocked by any player."
},
{
"role": "assistant",
"content": "SELECT a.achievement_id, a.name FROM gaming_technology.achievements a LEFT JOIN gaming_technology.player_achievements pa ON a.achievement_id = pa.ac... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points.... |
[
{
"role": "user",
"content": "What is the total balance for each currency in the accounts table?"
},
{
"role": "assistant",
"content": "SELECT currency, SUM(balance) AS total_balance FROM financial_services.accounts GROUP BY currency;"
},
{
"role": "user",
"content": "Can you also sh... | You are an SQL statement expert. Given the table 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": "For each passenger, show their passenger_id, first_name, last_name, the date and time of their earliest booking, and the date and time of their latest booking."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id,\n p.first_name,\n p.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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Show me the average market cap and average 24-hour price change percentage for tokens on each chain."
},
{
"role": "assistant",
"content": "SELECT chain, AVG(market_cap) AS average_market_cap, AVG(price_change_percentage_24h) AS average_price_change_24h FROM token_b... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character var... |
[
{
"role": "user",
"content": "For each guest, calculate the total number of service orders they have placed and the sum of quantities ordered. Show guest_id, order_count, and total_quantity."
},
{
"role": "assistant",
"content": "SELECT guest_id,\n COUNT(order_id) AS order_count,\n 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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"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 healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "List all assets mentioned in DApp descriptions along with the DApp name and URL."
},
{
"role": "assistant",
"content": "SELECT a.name AS asset_name,\n a.symbol AS asset_symbol,\n d.name AS dapp_name,\n d.url\nFROM trading_platform.assets a\nJOIN 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 trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name cha... |
[
{
"role": "user",
"content": "Show all trades that occurred after '2024-06-01', including the trade ID, quantity, price, and the name and symbol of the asset traded."
},
{
"role": "assistant",
"content": "SELECT t.trade_id, t.quantity, t.price, a.name AS asset_name, a.symbol AS asset_symbol FROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "For each insurance plan, provide the total number of patient insurance policies associated with it."
},
{
"role": "assistant",
"content": "SELECT plan_id, COUNT(*) AS policy_count FROM healthcare.patient_insurance GROUP BY plan_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 healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "List each insurance product's name and type, along with the number of active policies and the total premium_amount collected for those policies. Only include products that have at least one active policy."
},
{
"role": "assistant",
"content": "SELECT p.product_name,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "I want to find all medications manufactured by 'AbbVie' that have a description containing the word 'gel'. For each, show the medication ID, name, description, and the NDC code."
},
{
"role": "assistant",
"content": "SELECT medication_id, medication_name, descriptio... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "Which invoices were issued in March 2024, and what are their invoice numbers, total amounts, and due dates?"
},
{
"role": "assistant",
"content": "SELECT invoice_number, total_amount, due_date FROM legal_services.invoices WHERE issue_date >= '2024-03-01' AND issue_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": "What is the average token price held by Binance exchange across all chains?"
},
{
"role": "assistant",
"content": "SELECT AVG(price) as average_token_price FROM cex_token_balance WHERE exchange = 'Binance';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE cex_token_balance ( snapshot_time.text, chain.text, address.text, exchange.text, token_address.text, token_symbol.text,... |
[
{
"role": "user",
"content": "What is the total number of employees for each status that is not 'Active'?"
},
{
"role": "assistant",
"content": "SELECT status, COUNT(employee_id) AS employee_count FROM financial_services.employees WHERE status != 'Active' GROUP BY status;"
},
{
"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 financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"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.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.