system stringlengths 336 7.84k | conversations listlengths 2 8 |
|---|---|
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 financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_n... | [
{
"role": "user",
"content": "For each employee, show their full name, their manager's full name, and the number of days between their hire dates."
},
{
"role": "assistant",
"content": "SELECT e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n m.employee_id AS ma... |
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "List each property along with the total revenue generated from all delivered service orders, including the property name and total revenue."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, SUM(so.total_price) AS total_revenue\nFROM hospi... |
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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text... | [
{
"role": "user",
"content": "List each partner lawyer's first_name, last_name along with the count of invoices for the cases they lead."
},
{
"role": "assistant",
"content": "SELECT l.lawyer_id, l.first_name, l.last_name, COUNT(i.invoice_id) AS invoice_count\nFROM legal_services.lawyers l\nJOIN... |
You are an 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 financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id... | [
{
"role": "user",
"content": "Show me each account along with any loans linked to it. Include the account type, account balance, loan type, and loan principal amount."
},
{
"role": "assistant",
"content": "SELECT a.account_type, a.balance, l.loan_type, l.principal_amount FROM financial_services.... |
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 transactions together with any event emitted in the same transaction, showing transaction ID, event name, and event emitted timestamp."
},
{
"role": "assistant",
"content": "SELECT tx.transaction_id, ev.event_name, ev.emitted_at\nFROM web3.transactions tx\n... |
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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique iden... | [
{
"role": "user",
"content": "Show all patients along with the names of all insurance plans they are enrolled in, plus the insurance provider for each plan."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, ip.plan_name, ip.insurance_provider\nFROM healthcare... |
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 transportation.passengers ( passenger_id text PRIMARY KEY, first_name text, last_nam... | [
{
"role": "user",
"content": "List each passenger's first_name, last_name along with another passenger's first_name and last_name who share the same loyalty_program_id. Label them as member and peer."
},
{
"role": "assistant",
"content": "SELECT p1.first_name AS member_first, p1.last_name AS mem... |
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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.t... | [
{
"role": "user",
"content": "Show all users who have no wallets yet."
},
{
"role": "assistant",
"content": "SELECT DISTINCT k.user_id\nFROM trading_platform.kyc_audit k\nLEFT JOIN trading_platform.wallets w ON k.user_id = w.user_id\nWHERE w.wallet_id IS NULL;"
}
] |
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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique iden... | [
{
"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 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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text,... | [
{
"role": "user",
"content": "Which vehicles have been refueled more than 3 times in the last 30 days? Provide the vehicle_id, make, model, and refuel_count."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id,\n v.make,\n v.model,\n COUNT(fl.fuel_log_id) AS refuel_count... |
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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique iden... | [
{
"role": "user",
"content": "List the names and manufacturers of all medications that do not have an NDC code."
},
{
"role": "assistant",
"content": "SELECT medication_name, manufacturer\nFROM healthcare.medications\nWHERE ndc_code IS NULL;"
},
{
"role": "user",
"content": "Please a... |
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 character varying(64) NOT NULL, address character varyi... | [
{
"role": "user",
"content": "List the usernames and registration dates for users who registered before the earliest deployed contract."
},
{
"role": "assistant",
"content": "SELECT T1.username, T1.created_at FROM web3.users AS T1 JOIN (SELECT MIN(deployed_at) AS earliest_deploy FROM web3.contra... |
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 social_media.user_settings ( setting_id text, user_id text, theme text, email_notifi... | [
{
"role": "user",
"content": "Show the user IDs of all users whose theme is set to 'blue'."
},
{
"role": "assistant",
"content": "SELECT user_id FROM social_media.user_settings WHERE theme = 'blue';"
}
] |
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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id c... | [
{
"role": "user",
"content": "Show me each staff member and the count of service orders they have delivered."
},
{
"role": "assistant",
"content": "SELECT st.staff_id, st.first_name, st.last_name, COUNT(so.order_id) AS delivered_orders\nFROM hospitality_technology.staff st\nLEFT JOIN hospitality... |
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": "Get all active SUI coins with their owner and balance."
},
{
"role": "assistant",
"content": "SELECT coin_type, owner, balance\nFROM sui_coins\nWHERE status = 'active';"
},
{
"role": "user",
"content": "Join metadata to include the coin symbol and decima... |
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 insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, ... | [
{
"role": "user",
"content": "Find customers who have at least two policies with overlapping coverage periods. Show customer_id, policy1_id, policy2_id, overlap_start and overlap_end."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_id,\n p2.pol... |
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 transportation.trips (
trip_id character varying(64) NOT NULL, -- unique identi... | [
{
"role": "user",
"content": "Find pairs of trip IDs where both trips departed on the same calendar day, shared the same origin and destination locations, but were distinct trips."
},
{
"role": "assistant",
"content": "SELECT\n t1.trip_id AS trip_id_1,\n t2.trip_id AS trip_id_2,\n t1.origin_l... |
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 healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text... | [
{
"role": "user",
"content": "List all chronic diagnoses made by Cardiology specialists in the last year, including the patient ID, diagnosis description, and doctor's full name."
},
{
"role": "assistant",
"content": "SELECT dg.patient_id, dg.description, d.first_name || ' ' || d.last_name AS do... |
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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_bir... | [
{
"role": "user",
"content": "I want to retrieve all agents along with the number of active policies they've sold and the average premium amount of those active policies. Please include agent_id, first_name, last_name, policy_count, avg_premium. Sort the results by policy_count in descending order."
},
... |
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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birt... | [
{
"role": "user",
"content": "List all patients who have had appointments and were prescribed a medication manufactured by 'Merck'. Show the patient ID, full name, appointment ID, and medication name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT p.patient_id, p.first_name, p.last_name,... |
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 hospitality_technology.properties ( property_id.text, property_name.text, address_li... | [
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with their room types and base rates, ordered by star rating in descending order."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM h... |
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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_nam... | [
{
"role": "user",
"content": "Could you list the route number and the name of the destination location for routes that start at a location of type 'Depot'?"
},
{
"role": "assistant",
"content": "SELECT T1.route_number , T2.name FROM transportation.routes AS T1 JOIN transportation.locations AS T... |
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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text,... | [
{
"role": "user",
"content": "Show the first name and last name of customers along with the payment method for all their premium payments."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.payment_method FROM insurance.customers AS T1 JOIN insurance.premium_payments A... |
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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text... | [
{
"role": "user",
"content": "For each user, show their username and the number of unique IP addresses from the peers table where the port is less than 2000."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(DISTINCT p.ip_address) AS unique_ip_count\nFROM trading_platform.users u\n... |
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.users (
user_id character varying(64) NOT NULL, -- unique identifier for t... | [
{
"role": "user",
"content": "Count the number of users for each email domain."
},
{
"role": "assistant",
"content": "SELECT split_part(email, '@', 2) AS domain, COUNT(*) AS user_count\nFROM web3.users\nGROUP BY domain;"
},
{
"role": "user",
"content": "Filter to domains with more th... |
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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name charac... | [
{
"role": "user",
"content": "List all clients along with their case_number and case_type for cases that are currently 'Open'."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, c.email, cs.case_number, cs.case_type\nFROM legal_services.clients AS c\nJOIN legal_services.cas... |
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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, da... | [
{
"role": "user",
"content": "Which cities have more than 50 customers, and what is the average customer age in each?"
},
{
"role": "assistant",
"content": "SELECT city, COUNT(*) AS customer_count, AVG(EXTRACT(YEAR FROM AGE(CURRENT_DATE, date_of_birth))) AS avg_age\nFROM financial_services.custo... |
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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name characte... | [
{
"role": "user",
"content": "List patient_id, first_name, last_name, and date_of_birth for all patients older than 65 years."
},
{
"role": "assistant",
"content": "SELECT patient_id, first_name, last_name, date_of_birth\nFROM healthcare.patients\nWHERE date_of_birth < CURRENT_DATE - INTERVAL '6... |
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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number... | [
{
"role": "user",
"content": "List the full name (first and last) and specialization of all lawyers who work for law firms founded before the year 2000."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.specialization FROM lawyers AS T1 JOIN law_firms AS T2 ON T1.firm... |
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 erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, am... | [
{
"role": "user",
"content": "Find all wallets that hold at least one NFT and also hold ERC-20 tokens."
},
{
"role": "assistant",
"content": "SELECT DISTINCT nh.wallet_address\nFROM nft_holders nh\nJOIN erc20_balances eb\n ON nh.wallet_address = eb.wallet_address;"
},
{
"role": "user",
... |
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 legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, w... | [
{
"role": "user",
"content": "List the case number and name for all cases that do not have any linked invoices."
},
{
"role": "assistant",
"content": "SELECT T1.case_number, T1.case_name FROM cases AS T1 LEFT JOIN invoices AS T2 ON T1.case_id = T2.case_id WHERE T2.invoice_id IS NULL;"
},
{
... |
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 healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id... | [
{
"role": "user",
"content": "List each patient and the total number of chronic diagnoses they have received, as well as the number of distinct doctors who have made those diagnoses."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(*) AS chronic_diagnoses_count, COUNT(DISTINCT doc... |
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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- uniqu... | [
{
"role": "user",
"content": "Show me the room number, floor, and the name of the property for all rooms located in properties in Texas."
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T1.floor, T2.property_name FROM hospitality_technology.rooms AS T1 JOIN hospitality_technology.pr... |
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 social_media.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text )
C... | [
{
"role": "user",
"content": "How many unique hashtags has each post been associated with? Please return post_id and unique_hashtag_count."
},
{
"role": "assistant",
"content": "SELECT post_id, COUNT(DISTINCT hashtag_id) AS unique_hashtag_count\nFROM social_media.post_hashtags\nGROUP BY post_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.transactions ( transaction_id.text, from_address.text, to_address.text, value.n... | [
{
"role": "user",
"content": "Find all pairs of transactions where the gas price of the first transaction is lower than the gas price of the second transaction, but they are both from the same sender address. Show both transaction IDs, the common sender address, and the gas price for each."
},
{
"ro... |
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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_bir... | [
{
"role": "user",
"content": "How many customers were created in 2023?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*)\nFROM insurance.customers\nWHERE EXTRACT(YEAR FROM created_at) = 2023;"
}
] |
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 healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id t... | [
{
"role": "user",
"content": "How many insurance policies have 'Group' in their group_number?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE group_number ILIKE '%Group%';"
}
] |
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "Get the number of available services for each property. Include the property_name and service_count."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n COUNT(s.service_id) AS service_count\nFROM hospitality_technology.properties p\nLEFT JOIN hosp... |
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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, c... | [
{
"role": "user",
"content": "For each client, show the earliest and latest invoice issue_date, along with the total amount invoiced. Include client_id, earliest_issue_date, latest_issue_date, and total_amount."
},
{
"role": "assistant",
"content": "SELECT client_id, MIN(issue_date) AS earliest_... |
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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text... | [
{
"role": "user",
"content": "List all rooms that are currently marked as 'OutOfOrder' or 'Maintenance'. Show their room number and current status."
},
{
"role": "assistant",
"content": "SELECT room_number, status FROM hospitality_technology.rooms WHERE status IN ('OutOfOrder', 'Maintenance');"
... |
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 government_services.services ( service_id text, agency_id text, service_name text, d... | [
{
"role": "user",
"content": "List the names of employees and the agency they work for who have scheduled at least one appointment. Show the employee's first name, last name, and agency_id."
},
{
"role": "assistant",
"content": "SELECT DISTINCT e.first_name, e.last_name, e.agency_id\nFROM govern... |
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 hospitality_technology.reservations ( reservation_id character varying(64) NOT NULL,... | [
{
"role": "user",
"content": "Show me the count of service orders for each distinct status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(order_id) FROM hospitality_technology.service_orders GROUP BY status;"
},
{
"role": "user",
"content": "Also, include the total quan... |
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 financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, is... | [
{
"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 count FROM financial_services.securities WHERE sector = 'Technology' GROUP BY security_type;"
}
] |
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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.t... | [
{
"role": "user",
"content": "For each user, show their user ID and the count of unique wallet addresses they own."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(DISTINCT address) FROM wallets GROUP BY user_id;"
}
] |
You are an 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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_i... | [
{
"role": "user",
"content": "List all premium payments with a due date in March 2024."
},
{
"role": "assistant",
"content": "SELECT * FROM insurance.premium_payments WHERE due_date >= '2024-03-01' AND due_date <= '2024-03-31';"
}
] |
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 financial_services.transactions ( transaction_id text, account_id text, related_acco... | [
{
"role": "user",
"content": "Show me all failed transactions (status = 'FAILED') that involved US dollars, along with the account_id, amount, and transaction_date."
},
{
"role": "assistant",
"content": "SELECT transaction_id, account_id, amount, transaction_date\nFROM financial_services.transac... |
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 trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details ... | [
{
"role": "user",
"content": "Count the number of logs for each distinct action type."
},
{
"role": "assistant",
"content": "SELECT action, COUNT(*) AS log_count FROM trading_platform.logs GROUP BY action;"
}
] |
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 transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name te... | [
{
"role": "user",
"content": "Retrieve the route number and description for routes whose estimated duration exceeds 120 minutes."
},
{
"role": "assistant",
"content": "SELECT route_number, description\nFROM transportation.routes\nWHERE estimated_duration_minutes > 120;"
},
{
"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 token_dexpool_info (",
"pair_address character varying(512) NOT NULL, -- the ... | [
{
"role": "user",
"content": "For each chain, find the token with the highest price and the token with the lowest price. List chain, high_price_token, max_price, low_price_token, and min_price."
},
{
"role": "assistant",
"content": "WITH max_prices AS (\n SELECT chain,\n token_symbol AS... |
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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- uniqu... | [
{
"role": "user",
"content": "Retrieve the guest_id, first_name, last_name, and loyalty_member_id for all guests who have communication_consent enabled."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, loyalty_member_id\nFROM hospitality_technology.guests\nWHERE com... |
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 character varying(64) NOT NULL, -- unique identifi... | [
{
"role": "user",
"content": "Show me the average difficulty for blocks that have a previous block versus those that don't have a previous block."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN previous_block_id IS NULL THEN 'No Previous Block' ELSE 'Has Previous Block' END AS block_type... |
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": "Show the top 3 tokens on Polygon with the greatest positive price change over the last 6 hours, including their symbol, price, 6h change, and the number of smart money buy addresses in the last 24h."
},
{
"role": "assistant",
"content": "SELECT tdi.token_symbol, tdi... |
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 legal_services.cases (
case_id character varying(64) NOT NULL, -- unique identi... | [
{
"role": "user",
"content": "List the case ID, case number, and case name for all cases with status 'Open'."
},
{
"role": "assistant",
"content": "SELECT case_id, case_number, case_name FROM legal_services.cases WHERE status = 'Open';"
},
{
"role": "user",
"content": "Now, only show... |
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.wallets ( wallet_id text, user_id text, address text, private_key text, created... | [
{
"role": "user",
"content": "List all wallet addresses that have the same private key as another wallet, showing the wallet_id, address, and the shared private_key."
},
{
"role": "assistant",
"content": "SELECT w1.wallet_id, w1.address, w1.private_key\nFROM web3.wallets w1\nJOIN web3.wallets w2... |
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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id c... | [
{
"role": "user",
"content": "Which rooms on the 4th floor are non-smoking, along with their property IDs and type IDs?"
},
{
"role": "assistant",
"content": "SELECT room_id, property_id, room_number, room_type_id FROM hospitality_technology.rooms WHERE floor = 4 AND is_smoking = FALSE;"
}
] |
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 hospitality_technology.properties ( property_id text, property_name text, address_li... | [
{
"role": "user",
"content": "List all public reviews that have a staff response, showing the review ID, overall rating, and the full name of the staff member who responded."
},
{
"role": "assistant",
"content": "SELECT T1.review_id, T1.rating_overall, T2.first_name, T2.last_name FROM hospitalit... |
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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.t... | [
{
"role": "user",
"content": "Show me the top 5 users who have interacted with DApps the most, along with the count of interactions and their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT l.user_id, COUNT(*) AS interaction_count, w.address AS wallet_address FROM trading_platfor... |
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 social_media.posts ( post_id character varying(64) NOT NULL, user_id character varyi... | [
{
"role": "user",
"content": "How many distinct users have sent messages in each conversation? Return conversation_id and user_count."
},
{
"role": "assistant",
"content": "SELECT conversation_id,\n COUNT(DISTINCT sender_user_id) AS user_count\nFROM social_media.messages\nGROUP BY conversa... |
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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- un... | [
{
"role": "user",
"content": "Which citizens have scheduled appointments for services in the 'Benefits' category? Please show the first name and last name of the citizen, as well as the name of the service."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, s.service_name\n... |
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 social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url... | [
{
"role": "user",
"content": "For each group conversation, get the latest message's sender_user_id and sent_at, including conversation_id and group_name."
},
{
"role": "assistant",
"content": "SELECT c.conversation_id, c.group_name, m.sender_user_id, m.sent_at\nFROM social_media.conversations c\... |
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 trading_platform.wallets ( wallet_id text, user_id text, address text, private_key t... | [
{
"role": "user",
"content": "List all assets with their name, symbol, and type where the asset type is 'token'."
},
{
"role": "assistant",
"content": "SELECT name, symbol, type FROM trading_platform.assets WHERE type = 'token';"
}
] |
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 social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name characte... | [
{
"role": "user",
"content": "How many hashtags were created in each month of 2024?"
},
{
"role": "assistant",
"content": "SELECT date_trunc('month', created_at) AS month, COUNT(*) AS count\nFROM social_media.hashtags\nWHERE created_at >= '2024-01-01'\n AND created_at < '2025-01-01'\nGROUP BY m... |
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 transportation.routes ( route_id text PRIMARY KEY, route_number text, description te... | [
{
"role": "user",
"content": "For each city, show how many trips have started there (origin), how many have ended there (destination), and the total number of unique vehicles used in trips that started in that city."
},
{
"role": "assistant",
"content": "SELECT l.city,\n COUNT(CASE WHEN t.... |
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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_h... | [
{
"role": "user",
"content": "List usernames and the length of their 'bio' field for users whose 'is_verified' status is true."
},
{
"role": "assistant",
"content": "SELECT username, LENGTH(bio) AS bio_length FROM social_media.users WHERE is_verified IS TRUE;"
}
] |
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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, ... | [
{
"role": "user",
"content": "Show me all vehicles that are due for their next service before the end of this month, along with their last service date and type."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, s.service_date, s.service_type FROM transportation.vehicl... |
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 government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.... | [
{
"role": "user",
"content": "Get appointment_id, scheduled_start_time, service_name, location_name, and city for all appointments booked via 'Phone' at accessible locations."
},
{
"role": "assistant",
"content": "SELECT ap.appointment_id, ap.scheduled_start_time, s.service_name, sl.location_nam... |
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 legal_services.documents ( document_id.text, case_id.text, document_name.text, docum... | [
{
"role": "user",
"content": "Find pairs of documents within the same case that were uploaded on the same day but by different lawyers. Show the case_id, upload_date, document_id and uploader_id for both documents in the pair."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, DATE(d1.upl... |
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.text, project_id.text, project_name.text, rounds_nam... | [
{
"role": "user",
"content": "Which narrative from narrative_info has the highest token_num, and what is the total market cap and 24h volume for that narrative?"
},
{
"role": "assistant",
"content": "SELECT narrative, market_cap, volume_24h, token_num\nFROM narrative_info\nORDER BY token_num DES... |
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 healthcare.medical_records (
record_id character varying(64) NOT NULL, -- uniqu... | [
{
"role": "user",
"content": "List each patient's first and last medical record entries, showing patient_id, earliest_record_id, earliest_record_date, latest_record_id, and latest_record_date."
},
{
"role": "assistant",
"content": "SELECT\n fl.patient_id,\n fr.record_id AS earliest_record_... |
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.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique id... | [
{
"role": "user",
"content": "For each token, show the token_id and the total number of unique addresses that have ever received it."
},
{
"role": "assistant",
"content": "SELECT token_id, COUNT(DISTINCT to_address) AS unique_recipients\nFROM web3.token_transfers\nGROUP BY token_id;"
}
] |
You are an 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 hospitality_technology.properties ( property_id text, property_name text, address_li... | [
{
"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 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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate c... | [
{
"role": "user",
"content": "List all drivers."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name FROM transportation.drivers;"
},
{
"role": "user",
"content": "Can you also include their hire date and status?"
},
{
"role": "assistant",
"conte... |
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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text... | [
{
"role": "user",
"content": "Show me the number of primary insurance policies per insurance provider, including the provider name and the count."
},
{
"role": "assistant",
"content": "SELECT ip.insurance_provider, COUNT(*) AS primary_policy_count\nFROM healthcare.patient_insurance pi\nJOIN heal... |
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 gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT ... | [
{
"role": "user",
"content": "Generate a report showing the total number of achievement unlocks broken down by the calendar day they occurred. Show the date and the total number of unlocks for that day."
},
{
"role": "assistant",
"content": "SELECT DATE(unlocked_at) AS unlock_date, COUNT(player_... |
You are an 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 government_services.agencies ( agency_id text, agency_name text, jurisdiction_level ... | [
{
"role": "user",
"content": "List all employees with the job title 'Analyst'. Show their first name, last name, and department."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, department\nFROM government_services.employees\nWHERE job_title = 'Analyst';"
}
] |
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 gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.... | [
{
"role": "user",
"content": "Could you list all games, show their title and genre, and also include the total number of achievements for each game?"
},
{
"role": "assistant",
"content": "SELECT g.title, g.genre, COUNT(a.achievement_id) AS total_achievements FROM gaming_technology.games g LEFT J... |
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 legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number... | [
{
"role": "user",
"content": "Retrieve document names and the uploader's full name for all documents with version greater than 1."
},
{
"role": "assistant",
"content": "SELECT d.document_name,\n l.first_name || ' ' || l.last_name AS uploader\nFROM legal_services.documents d\nJOIN legal_ser... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 3