conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE contract_type = 'ERC1155' AND CA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"role": "user",
"content": "Show all transactions over 10,000 USD that are not marked as 'REVERSED'."
},
{
"role": "assistant",
"content": "SELECT transaction_id, account_id, amount, currency, status, transaction_date\nFROM financial_services.transactions\nWHERE amount > 10000 AND currency = '... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Find all patients who have active primary insurance plans from providers containing 'Blue' in their name, showing their full names and policy numbers."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, pi.policy_number FROM healthcare.patients ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "Show me pairs of passengers who share the same loyalty program, including their IDs, first and last names, and the loyalty_program_id."
},
{
"role": "assistant",
"content": "SELECT p1.passenger_id AS passenger1_id, p1.first_name AS first1, p1.last_name AS last1, p2.... | You are an SQL statement expert. Given the table 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.passengers ( passenger_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "Show me all pairs of time entries made by the same lawyer on the same date. Include both entry IDs, lawyer_id, and date_worked."
},
{
"role": "assistant",
"content": "SELECT t1.lawyer_id, t1.date_worked, t1.entry_id AS entry_id_1, t2.entry_id AS entry_id_2\nFROM leg... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique identifier for the time entry
... |
[
{
"role": "user",
"content": "List the full names of employees who have verified 'Proof of Identity' documents."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name FROM government_services.employees AS T1 JOIN government_services.documents AS T2 ON T1.employee_id =... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id text, application_id text, citizen_id text, document_type text, file_refere... |
[
{
"role": "user",
"content": "List policy pairs for the same customer where one policy was cancelled and another active policy started within 30 days after the cancellation. Show customer_id, cancelled policy_number, cancellation_date, active policy_number, start_date."
},
{
"role": "assistant",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "List the message subjects for all notifications sent via the 'Push' channel that have a 'Sent' status."
},
{
"role": "assistant",
"content": "SELECT message_subject FROM government_services.notifications WHERE channel = 'Push' AND status = 'Sent';"
}
] | You are an SQL statement expert. Given the table 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": "List the payment ID, amount paid, and due date for all premium payments with a status of 'overdue'."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount_paid, due_date FROM premium_payments WHERE status = 'overdue'"
}
] | You are an SQL statement expert. Given the table 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 for each asset_id, the number of associated metadata entries and the total number of notifications ever sent to users."
},
{
"role": "assistant",
"content": "SELECT m.asset_id, COUNT(m.metadata_id) AS metadata_count, (SELECT COUNT(*) FROM trading_platform.no... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.metadata ( metadata_id text, asset_id text, key text, value text )
CREATE TABLE trading_platform.notif... |
[
{
"role": "user",
"content": "Find all pairs of tokens that have the same token name but different contract addresses, showing both token IDs, the shared token name, and each contract address."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id_1, t2.token_id AS token_id_2, t1.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for the token
contract_address cha... |
[
{
"role": "user",
"content": "For each pair of origin and destination location IDs, show the number of completed trips between them."
},
{
"role": "assistant",
"content": "SELECT origin_location_id, destination_location_id, COUNT(*) AS completed_trip_count FROM transportation.trips WHERE status ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti... |
[
{
"role": "user",
"content": "List all accounts for customers who have at least one account with a balance over 10000 and another account with a balance under 1000. Show customer_id, account_id, account_type, balance, and currency."
},
{
"role": "assistant",
"content": "SELECT account_id , cust... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"role": "user",
"content": "Can you show me the number of unique doctors by specialty who were created after January 1st, 2024?"
},
{
"role": "assistant",
"content": "SELECT specialty, COUNT(DISTINCT doctor_id) AS doctor_count\nFROM healthcare.doctors\nWHERE created_at > '2024-01-01'\nGROUP BY... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "Show me the names of law firms founded after 2010, along with the full name of their managing partner."
},
{
"role": "assistant",
"content": "SELECT f.firm_name, l.first_name, l.last_name FROM legal_services.law_firms AS f JOIN legal_services.lawyers AS l ON f.manag... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "Show me all in-game items with the word 'Sword' in their name along with the total number of sessions in those games."
},
{
"role": "assistant",
"content": "SELECT i.item_id, i.item_name, COUNT(s.session_id) AS session_count\nFROM gaming_technology.in_game_items i\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers (
developer_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the d... |
[
{
"role": "user",
"content": "List the name and latest price for all tokens that have a price listed."
},
{
"role": "assistant",
"content": "SELECT t1.name, t2.price FROM token_metas AS t1 JOIN token_prices AS t2 ON t1.contract_address = t2.address WHERE t2.timestamp IN (SELECT MAX(timestamp) FR... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,... |
[
{
"role": "user",
"content": "Find the top 3 drivers by their average number of passengers per trip, including driver_id, first_name, last_name, and avg_passengers, ordered by avg_passengers descending."
},
{
"role": "assistant",
"content": "SELECT d.driver_id,\n d.first_name,\n d.la... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "List all unique hashtag IDs present in the system."
},
{
"role": "assistant",
"content": "SELECT DISTINCT hashtag_id FROM social_media.post_hashtags;"
},
{
"role": "user",
"content": "And how many users have chosen the 'dark' theme?"
},
{
"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 social_media.post_hashtags ( post_hashtag_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, ha... |
[
{
"role": "user",
"content": "Show me all servers where current_players is 0, and include their server_id, server_name, and region."
},
{
"role": "assistant",
"content": "SELECT server_id, server_name, region FROM gaming_technology.servers WHERE current_players = 0;"
},
{
"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 gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region text, ip_address text, port integer,... |
[
{
"role": "user",
"content": "List all pairs of users that registered on the same day, showing both user IDs and the registration date."
},
{
"role": "assistant",
"content": "SELECT u1.user_id AS user_id_1, u2.user_id AS user_id_2, DATE(u1.created_at) AS registration_date\nFROM web3.users u1\nJO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username character vary... |
[
{
"role": "user",
"content": "Give me the number of securities and the latest update timestamp for each security_type."
},
{
"role": "assistant",
"content": "SELECT security_type,\n COUNT(*) AS security_count,\n MAX(last_updated) AS latest_update\nFROM financial_services.securities\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.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "List the name of each agency and the total number of service locations it operates in New York State."
},
{
"role": "assistant",
"content": "SELECT a.agency_name, COUNT(sl.location_id) AS location_count\nFROM government_services.agencies a\nLEFT JOIN government_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.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e... |
[
{
"role": "user",
"content": "Can you give me all locations in Los Angeles?"
},
{
"role": "assistant",
"content": "SELECT location_id, name, type, address_line1, city, state_province, postal_code, country, latitude, longitude, timezone\nFROM transportation.locations\nWHERE city = 'Los Angeles';"... | You are an SQL statement expert. Given the table 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": "For each guest, list reservation_id, guest_id, check_in_date, and the next reservation_id and its check_in_date."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id,\n r1.guest_id,\n r1.check_in_date,\n r2.reservation_id AS next_reserva... | You are an SQL statement expert. Given the table 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.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ... |
[
{
"role": "user",
"content": "Show me all policies that expired in the last 60 days, along with their product IDs and premium amounts."
},
{
"role": "assistant",
"content": "SELECT policy_id, product_id, premium_amount FROM insurance.policies WHERE status = 'expired' AND end_date >= CURRENT_DATE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "Show me all active drivers whose licenses expire within the next 60 days, including their contact information."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, license_number, license_expiry_date, contact_number, email FROM transportat... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers (
driver_id character varying(64) NOT NULL, -- unique identifier for the driver
employe... |
[
{
"role": "user",
"content": "List all smart money addresses with a profit over $500,000, including their chain and last trade time."
},
{
"role": "assistant",
"content": "SELECT address, chain, last_trade_time FROM smart_money_profit WHERE profit > 500000;"
},
{
"role": "user",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_profit ( address character varying(100) NOT NULL, rank INT, profit numeric(38,6), roi numeric(38,2), realiz... |
[
{
"role": "user",
"content": "List all maintenance services performed on vehicle 'VHCL789', showing the service date and type."
},
{
"role": "assistant",
"content": "SELECT service_date, service_type FROM transportation.maintenance_logs WHERE vehicle_id = 'VHCL789';"
},
{
"role": "user",... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text PRIMARY KEY, vehicle_id text, service_date date, odometer_reading int, se... |
[
{
"role": "user",
"content": "Show me all claim documents that are PDFs, along with their claim IDs and file sizes."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_size_bytes FROM insurance.claim_documents WHERE mime_type = 'application/pdf';"
},
{
"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 insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"role": "user",
"content": "Could you provide the route number, the name of the origin location, and the name of the destination location for all routes?"
},
{
"role": "assistant",
"content": "SELECT T1.route_number , T2.name , T3.name FROM transportation.routes AS T1 JOIN transportation.loc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "List all room types and available services for each property, showing the property ID, room type name, base rate, service name, and service price."
},
{
"role": "assistant",
"content": "SELECT T1.property_id , T1.type_name , T1.base_rate , T2.service_name , T2.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 hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu... |
[
{
"role": "user",
"content": "List the names of all insurance providers who offer at least one plan of type 'EPO'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT insurance_provider\nFROM healthcare.insurance_plans\nWHERE plan_type = 'EPO';"
}
] | You are an SQL statement expert. Given the table 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": "List, for each passenger and trip combination, the total number of bookings and the total fare paid on that trip by each passenger."
},
{
"role": "assistant",
"content": "SELECT passenger_id, trip_id, COUNT(*) AS booking_count, SUM(fare) AS total_fare\nFROM transpor... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.bookings (
booking_id character varying(64) NOT NULL, -- unique identifier for the booking
pass... |
[
{
"role": "user",
"content": "List all SUI coins with 'active' status and their object_id, owner address, coin_type, and balance."
},
{
"role": "assistant",
"content": "SELECT object_id, owner, coin_type, balance FROM sui_coins WHERE status = 'active';"
},
{
"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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "List the distinct cities where service locations are present."
},
{
"role": "assistant",
"content": "SELECT DISTINCT city FROM government_services.service_locations;"
}
] | You are an SQL statement expert. Given the table 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.service_locations ( location_id text, agency_id text, location_name text, address text, city text, ... |
[
{
"role": "user",
"content": "Show me all patients who have scheduled appointments with doctors specializing in Cardiology, along with their appointment times and reasons."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, a.reason FROM hea... | You are an SQL statement expert. Given the table 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": "Get all beneficiaries added in the last 30 days. Include beneficiary_id, policy_id, first_name, last_name, and added_at, ordered by added_at descending."
},
{
"role": "assistant",
"content": "SELECT beneficiary_id,\n policy_id,\n first_name,\n last... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "Show the count of invoices for each case ID."
},
{
"role": "assistant",
"content": "SELECT case_id, COUNT(invoice_id) AS invoice_count FROM legal_services.invoices WHERE case_id IS NOT NULL GROUP BY case_id ORDER BY invoice_count DESC"
},
{
"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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "Show me the average smart money ROI and the total PNL for each narrative category, based on the `smart_money_token_performance` and `token_basic_info` tables."
},
{
"role": "assistant",
"content": "SELECT tbi.narrative, AVG(smp.roi) AS average_roi, SUM(smp.pnl) AS t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "For all maintenance records, can you show the vehicle's make, model, the odometer reading, and the mechanic's name?"
},
{
"role": "assistant",
"content": "SELECT v.make, v.model, m.odometer_reading, m.mechanic_name FROM transportation.maintenance_logs m JOIN transpo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "Could you list all unique item types available in the system and the number of items that belong to each type?"
},
{
"role": "assistant",
"content": "SELECT item_type, COUNT(item_id) AS item_count\nFROM gaming_technology.in_game_items\nGROUP BY item_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 gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ... |
[
{
"role": "user",
"content": "List all food and beverage services (category = 'Food & Beverage') with their names, prices, and units, where the price is less than $20."
},
{
"role": "assistant",
"content": "SELECT service_name, price, unit FROM hospitality_technology.services WHERE category = 'F... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "List all active policies, including their policy number, start date, end date, premium amount, and the name of the insurance product."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T1.start_date, T1.end_date, T1.premium_amount, T2.product_name 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 insurance.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "List the first name and last name of citizens who have scheduled appointments, along with the scheduled start time and purpose of their appointments."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.scheduled_start_time, T2.purpose 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List all booking IDs and their status for bookings that have a special request recorded."
},
{
"role": "assistant",
"content": "SELECT booking_id, status\nFROM transportation.bookings\nWHERE special_requests IS NOT NULL;"
},
{
"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 transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_... |
[
{
"role": "user",
"content": "List each branch_id, the number of employees in that branch, and the number of securities that trade on that branch's exchange."
},
{
"role": "assistant",
"content": "SELECT e.branch_id,\n COUNT(DISTINCT e.employee_id) AS employee_count,\n COUNT(s.securi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "How many unread notifications are there per user?"
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS unread_count\nFROM trading_platform.notifications\nWHERE read_at IS NULL\nGROUP BY user_id;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.metadata ( metadata_id text, asset_id text, key text, value text )
CREATE TABLE trading_platform.notif... |
[
{
"role": "user",
"content": "List all employees hired in 2023 along with their job title and email."
},
{
"role": "assistant",
"content": "SELECT employee_id, first_name, last_name, job_title, email\nFROM financial_services.employees\nWHERE EXTRACT(YEAR FROM hire_date) = 2023;"
},
{
"ro... | You are an SQL statement expert. Given the table 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 full names of all employees who are currently employed (i.e., have no termination date)."
},
{
"role": "assistant",
"content": "SELECT first_name || ' ' || last_name AS full_name FROM government_services.employees WHERE termination_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 government_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "Show me all securities along with the number of employees per branch that work at a branch matching the security's exchange as their branch_id. Show the ticker symbol, security name, exchange, branch_id, and employee count."
},
{
"role": "assistant",
"content": "SEL... | You are an SQL statement expert. Given the table 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": "Show me all cases with a status of 'Pending', displaying their case name and court jurisdiction."
},
{
"role": "assistant",
"content": "SELECT case_name, court_jurisdiction FROM legal_services.cases WHERE status = 'Pending';"
},
{
"role": "user",
"conten... | You are an SQL statement expert. Given the table 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 each user's username and the total number of trades they've participated in as buyers, including users who have not made any trades, sorted by the trade count descending."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(t.trade_id) AS buy_trade_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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "List all distinct medication IDs that have been prescribed with more than 5 refills allowed."
},
{
"role": "assistant",
"content": "SELECT DISTINCT medication_id FROM healthcare.prescriptions WHERE refills_allowed > 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 healthcare.prescriptions ( prescription_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio... |
[
{
"role": "user",
"content": "List documents uploaded for cases of type 'Intellectual Property', showing the document name, upload timestamp, and the case number."
},
{
"role": "assistant",
"content": "SELECT T1.document_name, T1.upload_timestamp, T2.case_number FROM documents AS T1 JOIN cases 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "How many addresses on the Polygon chain have an ROI above 5?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE chain = 'Polygon' AND roi > 5;"
},
{
"role": "user",
"content": "Also show the average prof... | You are an SQL statement expert. Given the table 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": "What is the average commission for trades executed on the 'NYSE' venue?"
},
{
"role": "assistant",
"content": "SELECT AVG(commission) FROM financial_services.trades WHERE execution_venue = 'NYSE';"
}
] | You are an SQL statement expert. Given the table 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.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.... |
[
{
"role": "user",
"content": "List the transaction IDs and gas used for transactions where gas used is greater than 500000."
},
{
"role": "assistant",
"content": "SELECT transaction_id, gas_used FROM web3.transactions WHERE gas_used > 500000;"
},
{
"role": "user",
"content": "Order 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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Show the usernames of players who have participated in game sessions on servers in the 'eu-central-1' region. Also include the server name, game title, and the session start time."
},
{
"role": "assistant",
"content": "SELECT p.username, s.server_name, g.title, gs.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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Find the earliest uploaded document for each claim. Show the claim_id, document_id, file_name, and uploaded_at."
},
{
"role": "assistant",
"content": "SELECT cd.claim_id, cd.document_id, cd.file_name, cd.uploaded_at\nFROM insurance.claim_documents cd\nINNER JOIN (\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 insurance.claim_documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"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 narrative_info (",
"narrative character varying(512) NOT NULL, -- the id of narrative",
"top_3_coins text, --... |
[
{
"role": "user",
"content": "Show me all servers, the title of the game they host, and the name of the game's developer."
},
{
"role": "assistant",
"content": "SELECT s.server_name, g.title AS game_title, d.name AS developer_name FROM gaming_technology.servers s JOIN gaming_technology.games g 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "List all services in the 'Concierge' department along with their names, price, and whether they are currently available. Include the property name as well."
},
{
"role": "assistant",
"content": "SELECT s.service_name, s.price, s.is_available, p.property_name\nFROM h... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Show me the total price and quantity for each service order, along with the guest's full name."
},
{
"role": "assistant",
"content": "SELECT t1.order_id, t1.total_price, t1.quantity, t2.first_name, t2.last_name FROM hospitality_technology.service_orders AS t1 JOIN h... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show me all managers (agents who have other agents reporting to them) along with their team size and average commission rate of their team members."
},
{
"role": "assistant",
"content": "SELECT m.agent_id, m.first_name, m.last_name, COUNT(r.agent_id) as team_size, 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 insurance.agents (
agent_id character varying(64) NOT NULL, -- unique identifier for the agent
first_name chara... |
[
{
"role": "user",
"content": "Find law firms where the managing partner is also listed as a lawyer within that firm. Show the firm name and the managing partner's first and last name."
},
{
"role": "assistant",
"content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms 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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "Calculate the average payment amount for all completed payments associated with services categorized as 'Healthcare'."
},
{
"role": "assistant",
"content": "SELECT AVG(T1.amount) FROM government_services.payments AS T1 INNER JOIN government_services.applications 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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "List the first name, last name, and job title for all employees."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, job_title FROM financial_services.employees;"
},
{
"role": "user",
"content": "Only show employees who are currently act... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "Show me pairs of wallets that belong to the same user, listing the wallet_id, user_id, address, and created_at for the earlier and later wallet in each pair."
},
{
"role": "assistant",
"content": "SELECT w1.user_id,\n w1.wallet_id AS earlier_wallet,\n w1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Can you show me the number of unique item types and the average cost amount for each game?"
},
{
"role": "assistant",
"content": "SELECT game_id, COUNT(DISTINCT item_type) AS unique_item_types, AVG(cost_amount) AS avg_cost_amount FROM gaming_technology.in_game_items... | You are an SQL statement expert. Given the table 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.in_game_items ( item_id uuid, game_id uuid, item_name text, item_type text, description text, rarity ... |
[
{
"role": "user",
"content": "List all chronic and active diagnoses for patient 'patient_456', including diagnosis_code, description, and diagnosis_date."
},
{
"role": "assistant",
"content": "SELECT diagnosis_code, description, diagnosis_date FROM healthcare.diagnoses WHERE patient_id = 'patien... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty... |
[
{
"role": "user",
"content": "Get the average price of all services for each category."
},
{
"role": "assistant",
"content": "SELECT category, AVG(price) AS avg_price\nFROM hospitality_technology.services\nGROUP BY category;"
},
{
"role": "user",
"content": "Only include categories w... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL... |
[
{
"role": "user",
"content": "Show the total hours spent by each lawyer, based on the time entries."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, SUM(hours_spent) FROM legal_services.time_entries GROUP BY lawyer_id"
},
{
"role": "user",
"content": "Only include time entrie... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "List tokens on the 'Arbitrum' chain with a 24-hour price change percentage greater than 10% and a market cap above 1,000,000 USD. Show their symbol, name, price, 24-hour change percentage, and market cap. Order the results by the 24-hour change percentage in descending order."
... | You are an SQL statement expert. Given the table 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_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO... |
[
{
"role": "user",
"content": "For each status, can you count how many servers are in that status and show the total number of current players for that status?"
},
{
"role": "assistant",
"content": "SELECT status, COUNT(server_id) AS server_count, SUM(current_players) AS total_current_players\nFR... | You are an SQL statement expert. Given the table 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": "Find documents that have the same document_name but are associated with different cases. Show the document name and the two different case IDs."
},
{
"role": "assistant",
"content": "SELECT d1.document_name, d1.case_id AS case_id_1, d2.case_id AS case_id_2 FROM lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "I need to list patients' full names along with the description and date of their most recent chronic diagnosis, including the diagnosing doctor's full name."
},
{
"role": "assistant",
"content": "SELECT p.first_name || ' ' || p.last_name AS patient_name, d.descripti... | You are an SQL statement expert. Given the table 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": "List each case_id along with entry_id pairs where one entry is billable and the other is non-billable for the same case."
},
{
"role": "assistant",
"content": "SELECT\n te1.case_id,\n te1.entry_id AS billable_entry,\n te2.entry_id AS non_billable_entry\nFROM lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique identifier for the time entry
... |
[
{
"role": "user",
"content": "List each case_number along with the total number of documents associated with it."
},
{
"role": "assistant",
"content": "SELECT c.case_number,\n COUNT(d.document_id) AS document_count\nFROM legal_services.cases c\nJOIN legal_services.documents d\n ON c.case_... | You are an SQL statement expert. Given the table 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": "Show me all the details for all policy beneficiaries."
},
{
"role": "assistant",
"content": "SELECT * FROM insurance.policy_beneficiaries;"
},
{
"role": "user",
"content": "Filter the results to only include beneficiaries for customer 'CUST987'."
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, la... |
[
{
"role": "user",
"content": "Show me tokens that have recorded smart money inflows. For these tokens, list the token symbol, the current price from the basic info table, and the total sum of USD values from all smart money inflows recorded for that token."
},
{
"role": "assistant",
"content": "... | 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.text, token_name.text, token_symbol.text, token_address.t... |
[
{
"role": "user",
"content": "List all pairs of clients who registered in the same year. Show each client's first_name, last_name, and the registration year."
},
{
"role": "assistant",
"content": "SELECT c1.first_name AS first_name_1, c1.last_name AS last_name_1, c2.first_name AS first_name_2, 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 legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "List the conversation IDs and user IDs for participants who have email notifications enabled."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, cp.user_id FROM social_media.conversation_participants AS cp JOIN social_media.user_settings AS us ON cp.u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "Find all patients who have never had a medical record entry. Show patient_id, first_name, and last_name."
},
{
"role": "assistant",
"content": "SELECT p.patient_id,\n p.first_name,\n p.last_name\nFROM healthcare.patients p\nLEFT JOIN healthcare.medical_r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "For each room, find the next higher room_number on the same floor and property. Show room_id, property_id, floor, room_number, next_room_id, next_room_number."
},
{
"role": "assistant",
"content": "SELECT r1.room_id,\n r1.property_id,\n r1.floor,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat... |
[
{
"role": "user",
"content": "List all distinct bed types and their corresponding maximum occupancies for each property."
},
{
"role": "assistant",
"content": "SELECT property_id, bed_type, MAX(max_occupancy) AS max_occupancy FROM hospitality_technology.room_types GROUP BY property_id, bed_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 hospitality_technology.room_types ( room_type_id.text, property_id.text, type_name.text, description.text, base_rate.nu... |
[
{
"role": "user",
"content": "Show me all unread notifications sent in the last 24 hours, along with the user IDs and message content, ordered by when they were sent."
},
{
"role": "assistant",
"content": "SELECT user_id, message, sent_at FROM trading_platform.notifications WHERE read_at 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 trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta... |
[
{
"role": "user",
"content": "Show me all smart contracts created by users whose email domain is 'gmail.com', along with the contract creation timestamp and the user's username."
},
{
"role": "assistant",
"content": "SELECT sc.contract_id, sc.timestamp, u.username FROM blockchain.smart_contracts... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "For every guest, show their first and last names, and the name of each property where they have made a reservation."
},
{
"role": "assistant",
"content": "SELECT g.first_name, g.last_name, p.property_name\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 character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "For each chain in the smart money token inflow data, calculate the total number of addresses involved in buy transactions and the total number of addresses involved in sell transactions. Display the chain, total buy addresses, and total sell addresses."
},
{
"role": "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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "Show me all trips that were delayed by more than 1 hour, including their vehicle and driver IDs, along with the origin and destination location IDs."
},
{
"role": "assistant",
"content": "SELECT trip_id, vehicle_id, driver_id, origin_location_id, destination_locatio... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips (
trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance
... |
[
{
"role": "user",
"content": "Which vehicles have a total maintenance cost exceeding 10000 across all their maintenance logs?"
},
{
"role": "assistant",
"content": "SELECT vehicle_id, SUM(cost) AS total_maintenance_cost FROM transportation.maintenance_logs GROUP BY vehicle_id HAVING SUM(cost) > ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "Find beneficiaries with percentage_share above 50% for policies that have any claim with estimated_loss greater than 20000. Show beneficiary_id, first_name, last_name, and policy_id."
},
{
"role": "assistant",
"content": "SELECT pb.beneficiary_id, pb.first_name, pb.... | You are an SQL statement expert. Given the table 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": "List the user ID, theme, and updated_at for users who have updated their settings in the last 90 days and have their theme set to 'dark'."
},
{
"role": "assistant",
"content": "SELECT user_id, theme, updated_at FROM social_media.user_settings WHERE updated_at >= NOW... | You are an SQL statement expert. Given the table 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.user_settings ( setting_id.text, user_id.text, theme.text, email_notifications_enabled.boolean, push_notif... |
[
{
"role": "user",
"content": "List all pairs of lawyers who have unbilled billable time entries for the same case. Include both lawyer IDs and the case_id."
},
{
"role": "assistant",
"content": "SELECT t1.lawyer_id AS lawyer1_id,\n t2.lawyer_id AS lawyer2_id,\n t1.case_id\nFROM legal... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "List the sent notifications related to appointments, including notification ID, message subject, citizen full name, and scheduled start time of the appointment."
},
{
"role": "assistant",
"content": "SELECT\n n.notification_id,\n n.message_subject,\n c.first_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "List the usernames and emails of users who have sent at least one notification."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username, T1.email FROM social_media.users AS T1 JOIN social_media.notifications AS T2 ON T1.user_id = T2.sender_user_id;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List all users who have multiple wallets with the same address."
},
{
"role": "assistant",
"content": "SELECT user_id, address, COUNT(*) AS duplicate_count FROM trading_platform.wallets GROUP BY user_id, address HAVING COUNT(*) > 1;"
},
{
"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 trading_platform.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_... |
[
{
"role": "user",
"content": "List all maintenance logs for each vehicle, including the vehicle_id, log_id, service_date, service_type, and name of the mechanic."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, log_id, service_date, service_type, mechanic_name\nFROM transportation.maint... | You are an SQL statement expert. Given the table 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 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 trading_platform.kyc_audit (
kyc_audit_id character varying(64) NOT NULL, -- unique identifier for the KYC audit
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.