conversations listlengths 2 8 | system stringlengths 288 7.75k |
|---|---|
[
{
"role": "user",
"content": "Show all appointments with subject containing 'Review' and their corresponding case_id."
},
{
"role": "assistant",
"content": "SELECT appointment_id, subject, case_id\nFROM legal_services.appointments\nWHERE subject ILIKE '%Review%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date... |
[
{
"role": "user",
"content": "List the first and last name of each citizen along with the city and state of the service location for their agency."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN 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.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Find all documents of type 'Correspondence' uploaded in 2023. Show the document name, upload timestamp, and the name of the case it belongs to."
},
{
"role": "assistant",
"content": "SELECT T1.document_name, T1.upload_timestamp, T2.case_name FROM legal_services.docu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "List all medical records, showing the record ID, record date, and the full name of the doctor who created the record. Include the patient ID as well."
},
{
"role": "assistant",
"content": "SELECT mr.record_id, mr.record_date, mr.patient_id, d.first_name, d.last_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"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 SQL statement expert. Given the table 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": "What is the schedule of trains arriving at platform 1A at station XYZ on December 25th, 2023?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about train schedules or specific arrival times as this data is not included in the platfo... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.p... |
[
{
"role": "user",
"content": "List all active SUI coins with status 'exists' in metadata, showing coin_type, symbol, name, balance, and description."
},
{
"role": "assistant",
"content": "SELECT sc.coin_type, sm.symbol, sm.name, sc.balance, sm.description\nFROM sui_coins sc\nJOIN sui_coins_metad... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 3 months, along with their narrative information if available."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name, pfr.valuation, pfr.rounds_name, pfr.investment_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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "List the citizen IDs for individuals who have both uploaded documents and made payments."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.citizen_id FROM documents AS T1 JOIN payments AS T2 ON T1.citizen_id = T2.citizen_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 character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "Give me the total billed amount for each invoice in 2024."
},
{
"role": "assistant",
"content": "SELECT invoice_id, SUM(hours_spent * billing_rate) AS total_billed_amount FROM legal_services.time_entries WHERE is_billed = TRUE AND EXTRACT(YEAR FROM date_worked) = 20... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu... |
[
{
"role": "user",
"content": "Show all rooms that are on floor 3."
},
{
"role": "assistant",
"content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;"
},
{
"role": "user",
"content": "For these rooms, include the property name and room n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Find the average percentage share among all beneficiaries for each distinct relationship type."
},
{
"role": "assistant",
"content": "SELECT relationship, AVG(percentage_share) FROM insurance.policy_beneficiaries GROUP BY relationship ORDER BY relationship;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "List all customers who reside in New York and were created in the system before 2023."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, last_name, created_at FROM insurance.customers WHERE state = 'NY' AND created_at < '2023-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "For each event, display its event_id, the event_id of the previous event in the same transaction (if any), and the log_index of both events."
},
{
"role": "assistant",
"content": "SELECT curr.event_id AS current_event_id,\n prev.event_id AS previous_event_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "Show me all home loans (loan_id, principal_amount, interest_rate) where the current principal balance is more than 75% of the original principal amount, along with the account_id and employee details (first_name, last_name) of the employee who processed the loan application."
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions ( transaction_id.text, account_id.text, related_account_id.text, transaction_type.text,... |
[
{
"role": "user",
"content": "I need to find passengers who have a specific phone number prefix '+1555'. Can you help with that?"
},
{
"role": "assistant",
"content": "db.passengers.find({ phone_number: { $regex: '^\\+1555' } }, { first_name: 1, last_name: 1, phone_number: 1, email: 1, _id: 0 })... | 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
// db.createCollection('passengers')
// Optional: db.passengers.createIndex({ passenger_id: 1 }, ... |
[
{
"role": "user",
"content": "Show the usernames and registration dates for all users whose email ends with '@gmail.com'."
},
{
"role": "assistant",
"content": "SELECT username, created_at FROM web3.users WHERE email LIKE '%@gmail.com';"
},
{
"role": "user",
"content": "Actually, can... | You are an SQL statement expert. Given the table 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 text, username text, email text, password_hash text, created_at timestamp )
|
[
{
"role": "user",
"content": "List the first and last names of employees and the full name of the citizens for whom they have scheduled appointments."
},
{
"role": "assistant",
"content": "SELECT T1.first_name , T1.last_name , T3.first_name , T3.last_name FROM government_services.employees 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 PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "For each KYC-approved user, list their wallet address and the date it was created."
},
{
"role": "assistant",
"content": "SELECT w.address, w.created_at\nFROM trading_platform.wallets w\nJOIN trading_platform.kyc_audit k ON w.user_id = k.user_id\nWHERE k.status = '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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Show me the number of direct replies each top-level comment has on post 'P200'."
},
{
"role": "assistant",
"content": "SELECT c.comment_id, COUNT(r.comment_id) AS reply_count FROM comments AS c LEFT JOIN comments AS r ON r.parent_comment_id = c.comment_id WHERE c.po... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t... |
[
{
"role": "user",
"content": "Can you show, for each employee, the full name and job title of their direct manager, as well as the employee's department and branch_id?"
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name AS employee_first_name, e.last_name AS employee_last_n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"role": "user",
"content": "Can you provide the total number of cars associated with a specific train with train_id 'train_789'?"
},
{
"role": "assistant",
"content": "SCARD train:train_789:cars"
}
] | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for platform details. Key format: platform:<platform_id>
// HSET platform:plat_123 ... |
[
{
"role": "user",
"content": "How many documents are there for each document_type? Show document_type and count ordered by the count in descending order."
},
{
"role": "assistant",
"content": "SELECT document_type,\n COUNT(*) AS count\nFROM legal_services.documents\nGROUP BY document_type\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "Count the number of prescriptions each doctor has written for medications manufactured by 'Pfizer' in the last 6 months."
},
{
"role": "assistant",
"content": "SELECT p.doctor_id, COUNT(*) AS prescription_count\nFROM healthcare.prescriptions p\nJOIN healthcare.medic... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List all depots (location type 'Depot') and the number of vehicles assigned to each. Include the depot name and city."
},
{
"role": "assistant",
"content": "SELECT T1.name , T1.city , COUNT(T2.vehicle_id) FROM transportation.locations AS T1 LEFT JOIN transportatio... | You are an SQL statement expert. Given the table 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": "Show the number of active agents in each license state."
},
{
"role": "assistant",
"content": "SELECT license_state,\n COUNT(*) AS active_agent_count\nFROM insurance.agents\nWHERE status = 'active'\nGROUP BY license_state;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
[
{
"role": "user",
"content": "Which customers have policies that expired in the last month? Please show the customer ID, policy number, and expiration date."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, p.policy_number, p.end_date\nFROM insurance.customers c\nJOIN insurance.polici... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "List all pairs of wallets that were created within 10 minutes of each other, showing both wallet IDs, the user_id, and both creation timestamps."
},
{
"role": "assistant",
"content": "SELECT\n w1.wallet_id AS wallet1_id,\n w2.wallet_id AS wallet2_id,\n w1.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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "How many documents were uploaded in the year 2023?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;"
}
] | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "Which projects raised funds in January 2022?"
},
{
"role": "assistant",
"content": "SELECT project_name, rounds_name, investment_value, investment_date FROM project_fundraising_record WHERE investment_date >= '2022-01-01' AND investment_date < '2022-02-01';"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts, and show their network IDs and deployment timestamps."
},
{
"role": "assistant",
"content": "SELECT address, network_id, deployed_at FROM web3.cont... | You are an SQL statement expert. Given the table 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": "List all pairs of law firms that were founded on the same month and day, showing their names, and the shared founding date. Exclude firms founded on January 1st."
},
{
"role": "assistant",
"content": "SELECT t1.firm_name AS firm1_name, t2.firm_name AS firm2_name, 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 legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... |
[
{
"role": "user",
"content": "List all appointments scheduled in the next 30 days with appointment_id, client_id, case_id, and any invoice_id linked to that case."
},
{
"role": "assistant",
"content": "SELECT\n a.appointment_id,\n a.client_id,\n a.case_id,\n i.invoice_id\nFROM legal_services... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... |
[
{
"role": "user",
"content": "For each vehicle, list its vehicle_id, license_plate, and any older vehicle of the same type (showing older_vehicle_id and older year)."
},
{
"role": "assistant",
"content": "SELECT cur.vehicle_id,\n cur.license_plate,\n old.vehicle_id AS older_vehicle_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "Show me each user's username, their wallet address, and the total quantity of open orders they have placed, along with the name of the asset for each order."
},
{
"role": "assistant",
"content": "SELECT u.username, w.address, o.asset_id, SUM(o.quantity) AS total_ope... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "List all medical records created in the last 7 days, including patient_id, doctor_id, and record_date."
},
{
"role": "assistant",
"content": "SELECT patient_id, doctor_id, record_date FROM healthcare.medical_records WHERE created_at >= CURRENT_DATE - INTERVAL '7 day... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam... |
[
{
"role": "user",
"content": "Show me all customers (customer_id, first_name, last_name) who have made trades in the last 30 days, along with the total trade amount for each customer, sorted by total trade amount in descending order."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, 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 financial_services.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
... |
[
{
"role": "user",
"content": "List all ERC20 tokens where the price is greater than $100, including their names and symbols."
},
{
"role": "assistant",
"content": "SELECT ti.name, ti.symbol FROM token_info ti JOIN token_prices tp ON ti.tick = tp.symbol WHERE tp.price > 100;"
},
{
"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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "Show the full names and contact emails of all citizens who have made a payment for an application that is currently in 'Pending' status."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name || ' ' || c.last_name AS full_name, c.contact_email\nFROM gov... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Count the total number of comments each user has made."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS comment_count FROM comments GROUP BY user_id;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t... |
[
{
"role": "user",
"content": "Find guests who have made at least one payment using a 'CreditCard'. List their full name (first and last name) and email address."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name, T1.email FROM hospitality_technology.guests AS T1 J... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests (
guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and contract addresses, but only include collections with more than 5000 tokens."
},
{
"role": "assistant",
"content": "SELECT nc.name, nc.contract_address, nc.floor_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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "Get the average overall review rating for each property. Return property_name and avg_rating."
},
{
"role": "assistant",
"content": "SELECT pr.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.reviews r\nJOIN hospitality_technology.prop... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List the first name, last name, and hire date of all lawyers who are partners."
},
{
"role": "assistant",
"content": "SELECT first_name , last_name , hire_date FROM legal_services.lawyers WHERE is_partner = TRUE"
}
] | You are an SQL statement expert. Given the table 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": "Find services that have associated documents with a 'Pending' verification status. Show the service name and the document type name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT s.service_name, dt.document_type_name FROM government_services.services AS s J... | You are an SQL statement expert. Given the table 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 ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.contract... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List document names and versions for documents that share the same case_id, showing each pair of versions."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version ... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "Find all medical records where the vitals JSON field contains a blood pressure reading with systolic higher than 140, and show the patient_id, record_date, and vitals."
},
{
"role": "assistant",
"content": "SELECT patient_id, record_date, vitals FROM healthcare.medi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "Show me all intercity routes with their origin and destination locations, including the city and country for each location."
},
{
"role": "assistant",
"content": "SELECT r.route_id, r.route_number, r.type, orig.name AS origin_name, orig.city AS origin_city, orig.cou... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes (
route_id character varying(64) NOT NULL, -- unique identifier for the route
route_numb... |
[
{
"role": "user",
"content": "Find all pairs of transactions that occurred in the same block and were sent to the same address. Show both transaction IDs, the shared recipient address, and the block number."
},
{
"role": "assistant",
"content": "SELECT t1.transaction_id AS tx1,\n t2.transa... | You are an SQL statement expert. Given the table 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.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price... |
[
{
"role": "user",
"content": "List the content and sent time for messages sent by user 'U101'."
},
{
"role": "assistant",
"content": "SELECT content, sent_at FROM social_media.messages WHERE sender_user_id = 'U101';"
},
{
"role": "user",
"content": "Could you also include the group 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 social_media.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "Show the guest's full name, reservation ID, check-in date, and status for all reservations made via 'Phone'."
},
{
"role": "assistant",
"content": "SELECT g.first_name, g.last_name, r.reservation_id, r.check_in_date, r.status FROM hospitality_technology.reservations... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, la... |
[
{
"role": "user",
"content": "Find all patients who have been prescribed medications with dosage greater than 50mg, along with their medication details and prescribing doctor's name."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, pr.dosage, pr.medication_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Provide the count of diagnoses by status."
},
{
"role": "assistant",
"content": "SELECT status,\n COUNT(*) AS count\nFROM healthcare.diagnoses\nGROUP BY status;"
},
{
"role": "user",
"content": "Now only include statuses with more than 10 diagnoses... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "Show me all pairs of patients who share the same emergency contact phone, including both patient IDs, their names, and the shared emergency contact phone."
},
{
"role": "assistant",
"content": "SELECT p1.patient_id,\n p1.first_name,\n p1.last_name,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "What are the fuel consumption rates per hour for the Boeing 747-8 model?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "Show me all business center services (category = 'Business Center') along with their property IDs and descriptions, where the service is available."
},
{
"role": "assistant",
"content": "SELECT service_name, property_id, description FROM hospitality_technology.servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "What is the performance review score for employee with ID 'EMP456' for the last quarter?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't assist with information about performance review scores as this data is not included in the employees table."
}
] | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.employees ( ... |
[
{
"role": "user",
"content": "Can you show me the total number of passengers registered in the database?"
},
{
"role": "assistant",
"content": "db.passengers.countDocuments({})"
}
] | 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
// db.createCollection('passengers')
// Optional: db.passengers.createIndex({ passenger_id: 1 }, ... |
[
{
"role": "user",
"content": "List all accounts (account_id, account_number, balance) that have at least one trade with a total_amount greater than $50,000, along with the count of such trades for each account."
},
{
"role": "assistant",
"content": "SELECT a.account_id, a.account_number, a.balan... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "I need to find all bookings for a specific schedule with schedule_id 'sched_1122' and include the passenger and ticket details."
},
{
"role": "assistant",
"content": "SMEMBERS schedule:sched_1122:bookings\nHGETALL booking:book_*\nHGETALL passenger:pass_*\nSMEMBERS b... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for platform details. Key format: platform:<platform_id>
// HSET platform:plat_123 ... |
[
{
"role": "user",
"content": "List pairs of citizens who share the same email domain."
},
{
"role": "assistant",
"content": "SELECT c1.first_name AS first1,\n c1.last_name AS last1,\n c2.first_name AS first2,\n c2.last_name AS last2,\n SPLIT_PART(c1.contact_email, '@', 2)... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?"
},
{
"role": "assistant",
"content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.develo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "Show me each service order along with the next order placed by the same guest, including both order IDs and the time difference in minutes between the two orders."
},
{
"role": "assistant",
"content": "SELECT a.order_id,\n b.order_id AS next_order_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or... |
[
{
"role": "user",
"content": "Show each service's name along with the total number of appointments scheduled and the number of unique locations these appointments are scheduled at."
},
{
"role": "assistant",
"content": "SELECT s.service_name, COUNT(a.application_id) AS appointment_count, COUNT(D... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Find receiver addresses that have received transactions from more than 5 distinct sender addresses. Show the receiver address and the count of distinct senders."
},
{
"role": "assistant",
"content": "SELECT receiver_address, COUNT(DISTINCT sender_address) FROM block... | You are an SQL statement expert. Given the table 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.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 12 months, along with their token symbol and price from the token_basic_info table."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name, pfr.valuation, tbi.token_symbol,... | You are an SQL statement expert. Given the table 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 ch... |
[
{
"role": "user",
"content": "List every diagnosis description paired with every insurance plan's website."
},
{
"role": "assistant",
"content": "SELECT T1.description, T2.website FROM healthcare.diagnoses AS T1 CROSS JOIN healthcare.insurance_plans AS T2;"
},
{
"role": "user",
"cont... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i... |
[
{
"role": "user",
"content": "List all ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.contract... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "Show me the full names and phone numbers of customers living in Chicago who registered after January 1, 2023, along with their current status."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, last_name, phone_number, status\nFROM insurance.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 insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Show me all token names and their contract addresses along with the wallet addresses of users who created wallets in the last 30 days, sorted by wallet creation date."
},
{
"role": "assistant",
"content": "SELECT t.token_name, t.contract_address, w.address AS wallet... | You are an SQL statement expert. Given the table 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, contract_address character varying(128) NOT NULL, token_name cha... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 3