conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me all distinct dosage forms used in prescriptions."
},
{
"role": "assistant",
"content": "SELECT DISTINCT dosage FROM healthcare.prescriptions;"
}
] | You are an SQL statement expert. Given the table 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": "How many games are available in each genre? List genre and game_count."
},
{
"role": "assistant",
"content": "SELECT genre, COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY genre;"
},
{
"role": "user",
"content": "Now only include genres wi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "List pairs of routes where the destination of one route matches the origin of another route."
},
{
"role": "assistant",
"content": "SELECT r1.route_number AS route_1, r2.route_number AS route_2 FROM transportation.routes r1 JOIN transportation.routes r2 ON r1.destin... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin... |
[
{
"role": "user",
"content": "Which tokens on BSC and Polygon have a ROI higher than 2 this year? Show their symbols, ROI, and average cost."
},
{
"role": "assistant",
"content": "SELECT token_symbol, roi, avg_cost, chain FROM smart_money_token_performance WHERE (chain = 'BSC' OR chain = 'Polygo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "How many time entries does each client have? Provide the client's first and last name along with the count, sorted by count descending."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(te.entry_id) AS entry_count FROM legal_services.cli... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "List all document IDs, file names, and uploaded timestamps for documents that were uploaded on a weekend."
},
{
"role": "assistant",
"content": "SELECT document_id, file_name, uploaded_at FROM insurance.claim_documents WHERE EXTRACT(DOW FROM uploaded_at) IN (0, 6);"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "List appointments for patients who have an insurance policy with a group number assigned. Show the appointment ID, patient ID, and appointment time."
},
{
"role": "assistant",
"content": "SELECT T1.appointment_id , T1.patient_id , T1.appointment_time FROM healthca... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"role": "user",
"content": "Show the total value and total gas used for all transactions occurring in each distinct year."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM timestamp) AS transaction_year, SUM(value) AS total_value, SUM(gas_used) AS total_gas_used FROM web3.transac... | You are an SQL statement expert. Given the table 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": "Which hashtags were created after May 15, 2024? Show their hashtag IDs and tag names."
},
{
"role": "assistant",
"content": "SELECT hashtag_id, tag_name FROM social_media.hashtags WHERE created_at > '2024-05-15';"
},
{
"role": "user",
"content": "Now, on... | You are an SQL statement expert. Given the table 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.hashtags (
hashtag_id character varying(64) NOT NULL, -- unique identifier for the hashtag
tag_nam... |
[
{
"role": "user",
"content": "Get a count of available rooms per room type across all properties."
},
{
"role": "assistant",
"content": "SELECT T2.type_name, COUNT(T1.room_id) AS available_room_count FROM hospitality_technology.rooms AS T1 INNER JOIN hospitality_technology.room_types AS T2 ON 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "For each reservation, can you show the guest's full name, the property name, and the room number?"
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS guest_full_name, p.property_name, rm.room_number\nFROM hospitality... | You are an SQL statement expert. Given the table 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 service names and the count of completed payments for each service."
},
{
"role": "assistant",
"content": "SELECT s.service_id, s.service_name, COUNT(p.payment_id) AS completed_payment_count\nFROM government_services.services s\nLEFT JOIN government_service... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List all security_ids that had at least one day where the high_price was more than twice the low_price, along with the maximum price difference (high_price - low_price) observed for each security."
},
{
"role": "assistant",
"content": "SELECT security_id, MAX(high_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 financial_services.market_data ( data_point_id bigint, security_id text, data_timestamp timestamp, open_price numeric, ... |
[
{
"role": "user",
"content": "How many unique users have a KYC audit record with status 'pending'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT user_id) AS pending_kyc_users\nFROM trading_platform.kyc_audit\nWHERE status = 'pending';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.dapps (
dapp_id character varying(64) NOT NULL, -- unique identifier for the DApp
name charac... |
[
{
"role": "user",
"content": "Show the first name, last name, and position of all staff members who are not currently active."
},
{
"role": "assistant",
"content": "SELECT first_name , last_name , position FROM hospitality_technology.staff WHERE is_active = false"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List all SUI coins that have status 'exists' in both `sui_coins` and `sui_coins_metadata`. Show their `coin_type`, `balance`, and `owner`."
},
{
"role": "assistant",
"content": "SELECT sc.coin_type, sc.balance, sc.owner FROM sui_coins sc JOIN sui_coins_metadata scm ... | You are an SQL statement expert. Given the table 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 top 10 transactions by gas price, including the from_address, to_address, and block_number, sorted in descending order."
},
{
"role": "assistant",
"content": "SELECT from_address, to_address, block_number, gas_price FROM web3.transactions ORDER BY gas_pr... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, from_address text, to_address text, value numeric, gas_used int, g... |
[
{
"role": "user",
"content": "Show me a list of active Sui NFTs with their object ID, name, and owner."
},
{
"role": "assistant",
"content": "SELECT object_id, name, owner FROM sui_nfts WHERE status = 'exists';"
},
{
"role": "user",
"content": "Please include the collection type and ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "Show all patient insurance records including the policy number, effective date, and the name of the associated insurance plan."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T1.effective_date, T2.plan_name FROM healthcare.patient_insurance AS T1 JOI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "Show each user's username and the total number of notifications they have received."
},
{
"role": "assistant",
"content": "SELECT T1.username, count(T2.notification_id) FROM users AS T1 LEFT JOIN notifications AS T2 ON T1.user_id = T2.user_id GROUP BY T1.user_id, 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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Show me each sender_user_id along with the total number of messages they have sent in each conversation."
},
{
"role": "assistant",
"content": "SELECT conversation_id, sender_user_id, COUNT(*) AS message_count FROM social_media.messages GROUP BY conversation_id, sen... | You are an SQL statement expert. Given the table 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, conversation_id character varying(64) NOT NULL, send... |
[
{
"role": "user",
"content": "Show the number of lawyers hired in each year."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM hire_date) AS hire_year, COUNT(*) AS lawyer_count FROM legal_services.lawyers GROUP BY hire_year ORDER BY hire_year;"
},
{
"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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "How many documents are in each verification status?"
},
{
"role": "assistant",
"content": "SELECT verification_status, COUNT(*) FROM documents GROUP BY verification_status"
},
{
"role": "user",
"content": "For 'Verified' documents, show the count uploade... | You are an SQL statement expert. Given the table 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": "Please list the first name, last name, and date of birth for all female patients who were created in the year 2023."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE gender = 'Female' AND created_at >= ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "What is the average investment_value and total number of projects for each rounds_name in project_fundraising_record?"
},
{
"role": "assistant",
"content": "SELECT rounds_name,\n AVG(investment_value) AS avg_investment,\n COUNT(DISTINCT project_id) AS pr... | You are an SQL statement expert. Given the table 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": "Calculate the average length of stay in days for completed reservations for each property."
},
{
"role": "assistant",
"content": "SELECT p.property_id,\n p.property_name,\n AVG(res.check_out_date - res.check_in_date) AS avg_stay_days\nFROM hospitality_te... | You are an SQL statement expert. Given the table 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": "What is the total sum of all amounts for all UTXOs in the system, regardless of whether they are spent or unspent?"
},
{
"role": "assistant",
"content": "SELECT SUM(amount) FROM trading_platform.utxos"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "List the usernames of users who have joined a conversation and sent at least one message in it. Include the conversation_id for each."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, cp.conversation_id\nFROM social_media.conversation_participants 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 social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "Find all wallets created by users in the last 7 days along with any tokens that have a total supply greater than 10 million, showing the wallet address and token details."
},
{
"role": "assistant",
"content": "SELECT w.address AS wallet_address, t.token_name, t.toke... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "How many bookings were made each day in April 2024?"
},
{
"role": "assistant",
"content": "SELECT DATE(booking_time) AS booking_date, COUNT(*) AS booking_count FROM transportation.bookings WHERE EXTRACT(YEAR FROM booking_time) = 2024 AND EXTRACT(MONTH FROM booking_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 transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ... |
[
{
"role": "user",
"content": "Show me the top 5 addresses with the highest balances, along with their public keys."
},
{
"role": "assistant",
"content": "SELECT address_id, public_key, balance FROM blockchain.addresses ORDER BY balance DESC LIMIT 5;"
},
{
"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 blockchain.addresses (
address_id character varying(128) NOT NULL, -- unique identifier for the address
public... |
[
{
"role": "user",
"content": "For each lawyer, show their first name, last name, and the total number of documents they have uploaded, along with the names of the law firms they belong to."
},
{
"role": "assistant",
"content": "SELECT l.first_name, l.last_name, f.firm_name, COUNT(d.document_id) ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me a list of all patient names along with the full names of their doctors for appointments scheduled in February 2024."
},
{
"role": "assistant",
"content": "SELECT p.first_name AS patient_first_name, p.last_name AS patient_last_name, d.first_name AS doctor_fir... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "I want to list all employees who currently manage at least one other employee, showing their full name, email, and the total number of direct reports for each manager."
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name || ' ' || e.last_name AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "Show me all Sui NFTs with status 'exists', including their object_id, name, owner, and collection_type."
},
{
"role": "assistant",
"content": "SELECT object_id, name, owner, collection_type FROM sui_nfts WHERE status = 'exists';"
},
{
"role": "user",
"co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "Find all beneficiaries added in the last 7 days, include beneficiary_id, policy_id, and percentage_share, sorted by percentage_share descending."
},
{
"role": "assistant",
"content": "SELECT beneficiary_id, policy_id, percentage_share\nFROM insurance.policy_benefici... | You are an SQL statement expert. Given the table 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": "Retrieve medical_record IDs, patient IDs, and record dates for patients born before January 1st, 1980."
},
{
"role": "assistant",
"content": "SELECT mr.record_id, mr.patient_id, mr.record_date\nFROM healthcare.medical_records mr\nJOIN healthcare.patients p\n ON mr.... | You are an SQL statement expert. Given the table 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": "How many users is each user following? Provide follower_user_id and the count of followings."
},
{
"role": "assistant",
"content": "SELECT follower_user_id, COUNT(*) AS following_count\nFROM social_media.follows\nGROUP BY follower_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.follows ( follow_id character varying(64) NOT NULL, follower_user_id character varying(64) NOT NULL, follo... |
[
{
"role": "user",
"content": "For each contract that has deployed tokens, show the contract address, the name and symbol of each token it deployed, and the deployment status of the contract."
},
{
"role": "assistant",
"content": "SELECT c.address AS contract_address, t.token_name, t.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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "List all guests who have opted out of communication, including their first name, last name, and email."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM hospitality_technology.guests WHERE communication_consent = false;"
},
{
"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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "List all invoices where amount_paid is less than total_amount."
},
{
"role": "assistant",
"content": "SELECT *\nFROM legal_services.invoices\nWHERE amount_paid < total_amount;"
},
{
"role": "user",
"content": "Only include those with due_date before toda... | You are an SQL statement expert. Given the table 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": "특정 품질 등급 이상의 공급업체를 조회하고 싶습니다. 품질 등급, 공급업체 이름, 국가를 포함해 주세요."
},
{
"role": "assistant",
"content": "GET suppliers/_search\n{\n \"query\": {\n \"range\": {\n \"quality_rating\": {\n \"gte\": 4.0\n }\n }\n },\n \"_source\": [\"supplier_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
Index 'suppliers'. Mapping: { properties: { supplier_id: { type: 'keyword' }, supplier_name: { ty... |
[
{
"role": "user",
"content": "Show me all patients who have had prescriptions for a medication named 'Metformin', including their full name, prescription date, and prescribing doctor's ID."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, pr.prescription_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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "Find the contract ID, address, and deployer address for all contracts that have not emitted any events."
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address, c.deployer_address FROM web3.contracts AS c LEFT JOIN web3.events AS e ON c.contract_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.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,... |
[
{
"role": "user",
"content": "Show the full name and email of all drivers who have an expired license (license_expiry_date before today)."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email\nFROM transportation.drivers\nWHERE license_expiry_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 transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "Show me the number of accounts and their average balance for each status and currency combination."
},
{
"role": "assistant",
"content": "SELECT status, currency, COUNT(*) AS account_count, AVG(balance) AS average_balance\nFROM financial_services.accounts\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 financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "Show all log IDs and service dates for maintenance logs where the next service due date is not recorded."
},
{
"role": "assistant",
"content": "SELECT log_id , service_date FROM transportation.maintenance_logs WHERE next_service_due_date IS NULL"
},
{
"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 transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "List all maintenance logs for vehicles that had 'Oil Change' service in the last 3 months, showing vehicle ID, service date, and cost."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_typ... | You are an SQL statement expert. Given the table 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 text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "Provide a list of all customers whose status is 'Active' and show their customer_id, full name, and email address."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name || ' ' || last_name AS full_name, email\nFROM insurance.customers\nWHERE 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 insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Show all diagnoses, including the diagnosis ID, description, diagnosis date, and the full name of the doctor who made the diagnosis."
},
{
"role": "assistant",
"content": "SELECT T1.diagnosis_id, T1.description, T1.diagnosis_date, T2.first_name, T2.last_name FROM he... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "List all documents, including their document_id, document_type, upload_timestamp, and the reference number of the associated application."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.document_type, d.upload_timestamp, a.reference_number\nFROM gover... | You are an SQL statement expert. Given the table 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": "Which smart money address on the Ethereum chain has the lowest ROI, and what are their profit and rank?"
},
{
"role": "assistant",
"content": "SELECT address, roi, profit, rank FROM smart_money_profit WHERE chain = 'Ethereum' ORDER BY roi ASC LIMIT 1;"
},
{
... | You are an SQL statement expert. Given the table 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": "Show me the user IDs and the notification types for users who have participated in any conversation. Also show the conversation ID they joined."
},
{
"role": "assistant",
"content": "SELECT cp.user_id, n.notification_type, cp.conversation_id\nFROM social_media.conve... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "What is the total amount of the ERC20 token with contract address '0x112233...' held across all wallets?"
},
{
"role": "assistant",
"content": "SELECT SUM(CAST(amount AS DECIMAL)) FROM erc20_balances_historical WHERE contract_address = '0x112233...'"
},
{
"r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "Find all smart contracts where the code length is greater than 1000 characters."
},
{
"role": "assistant",
"content": "SELECT contract_id, creator_address, LENGTH(code) AS code_length\nFROM blockchain.smart_contracts\nWHERE LENGTH(code) > 1000\nORDER BY code_length ... | You are an SQL statement expert. Given the table 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.smart_contracts ( contract_id text, creator_address text, code text, timestamp timestamp )
|
[
{
"role": "user",
"content": "Which projects raised more than 10 million in their fundraising rounds, and what are their round names and valuations?"
},
{
"role": "assistant",
"content": "SELECT project_name, rounds_name, investment_value, valuation FROM project_fundraising_record WHERE investme... | You are an SQL statement expert. Given the table 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": "List all case numbers, names, and types."
},
{
"role": "assistant",
"content": "SELECT case_number, case_name, case_type FROM legal_services.cases;"
},
{
"role": "user",
"content": "Only include cases opened after 2023."
},
{
"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 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 the full names and positions of all staff members along with the name of the property they work for."
},
{
"role": "assistant",
"content": "SELECT s.first_name || ' ' || s.last_name AS full_name, s.position, p.property_name\nFROM hospitality_technology.staff s\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir... |
[
{
"role": "user",
"content": "Find the location name, address, and city for all accessible service locations located in the state of 'California'. Order the results by city."
},
{
"role": "assistant",
"content": "SELECT location_name, address, city FROM government_services.service_locations WHER... | You are an SQL statement expert. Given the table 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 a list of all documents, along with the case name and the email of the client related to each document."
},
{
"role": "assistant",
"content": "SELECT d.document_name, c.case_name, cl.email\nFROM legal_services.documents d\nJOIN legal_services.cases c ON d.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.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad... |
[
{
"role": "user",
"content": "Show me the number of guests for each city they reside in."
},
{
"role": "assistant",
"content": "SELECT city, count(*) AS guest_count FROM hospitality_technology.guests WHERE city IS NOT NULL GROUP BY city;"
},
{
"role": "user",
"content": "Now, only sh... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "List the token_id, token_symbol, and token_name for all tokens where the symbol has more than 4 characters."
},
{
"role": "assistant",
"content": "SELECT token_id, token_symbol, token_name FROM web3.tokens WHERE LENGTH(token_symbol) > 4;"
},
{
"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 web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "For each verified user, count their followers and show user_id and follower_count, ordered by follower_count descending."
},
{
"role": "assistant",
"content": "SELECT u.user_id,\n COUNT(f.follower_user_id) AS follower_count\nFROM social_media.users u\nJOIN soc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "List the full name, email, and phone number of all partners together with the full name of a non-partner lawyer in the same law firm."
},
{
"role": "assistant",
"content": "SELECT p.first_name AS partner_first_name, p.last_name AS partner_last_name, p.email AS partn... | You are an SQL statement expert. Given the table 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": "Show the names, symbols, and types of all assets whose symbol starts with the letter 'B'."
},
{
"role": "assistant",
"content": "SELECT name, symbol, type\nFROM trading_platform.assets\nWHERE symbol LIKE 'B%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name cha... |
[
{
"role": "user",
"content": "List all users who had their KYC status changed from approved to rejected, along with the timestamps of both audits."
},
{
"role": "assistant",
"content": "WITH status_changes AS (SELECT a.user_id, a.status as old_status, b.status as new_status, a.reviewed_at as old... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.kyc_audit (
kyc_audit_id character varying(64) NOT NULL, -- unique identifier for the KYC audit
... |
[
{
"role": "user",
"content": "For each citizen who has made a payment for an application that is still in 'Processing' status, list their full name, application_id, payment_id, amount, currency, and the application status."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Retrieve the top 5 players by the number of distinct achievements unlocked. Show player_id and distinct_unlocks."
},
{
"role": "assistant",
"content": "SELECT p.player_id, COUNT(DISTINCT pa.achievement_id) AS distinct_unlocks\nFROM gaming_technology.players p\nJOIN ... | You are an SQL statement expert. Given the table 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": "Show all prescriptions along with the patient's full name and the medication name. Include prescription_id, prescription_date, patient first_name, patient last_name, and medication_name."
},
{
"role": "assistant",
"content": "SELECT pr.prescription_id,\n pr.pr... | You are an SQL statement expert. Given the table 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 customer-employee pairs where they share the same email domain, showing customer_id, customer email, employee_id, and employee email."
},
{
"role": "assistant",
"content": "SELECT c.customer_id,\n c.email AS customer_email,\n e.employee_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 financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Which clients have appointments scheduled for a case that also has at least one invoice issued? Please show the client_id, appointment_id, appointment start_time, related case_id, and invoice_number."
},
{
"role": "assistant",
"content": "SELECT a.client_id, a.appoi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date... |
[
{
"role": "user",
"content": "For each citizen, get their full name and the count of documents they have uploaded."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(d.document_id) AS document_count\nFROM government_services.citizens AS c\nLEFT JOIN government_service... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show me all reservations with more than 2 adults, along with their property names and room types."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, p.property_name, r.room_type_id, r.num_adults FROM hospitality_technology.reservations r JOIN hospitalit... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city.... |
[
{
"role": "user",
"content": "Show me a summary of all clients with the total number of invoices they've received and the sum of total_amount for those invoices."
},
{
"role": "assistant",
"content": "SELECT cl.client_id,\n CONCAT(cl.first_name, ' ', cl.last_name) AS client_name,\n 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Please list all law firms with their names and address, and also indicate the year they were founded."
},
{
"role": "assistant",
"content": "SELECT firm_name, address, EXTRACT(YEAR FROM founded_date) AS founded_year FROM legal_services.law_firms;"
},
{
"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 legal_services.law_firms ( firm_id.text, firm_name.text, address.text, phone.text, website.text, founded_date.date, man... |
[
{
"role": "user",
"content": "List the user ID and username for users who have placed orders for assets of type 'cryptocurrency'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id, T1.username FROM trading_platform.users AS T1 JOIN trading_platform.orders AS T2 ON T1.user_id = T2... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "How many fuel logs were created for each unit of measurement? Show the unit and the corresponding count."
},
{
"role": "assistant",
"content": "SELECT unit, COUNT(*) as log_count\nFROM transportation.fuel_logs\nGROUP BY unit;"
},
{
"role": "user",
"conte... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... |
[
{
"role": "user",
"content": "List the usernames and status of all players who have 'de' as their country_code."
},
{
"role": "assistant",
"content": "SELECT username, status FROM gaming_technology.players WHERE country_code = 'DE';"
},
{
"role": "user",
"content": "Can you also add ... | You are an SQL statement expert. Given the table 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": "Which document types have been uploaded by citizens, and how many times has each type been uploaded?"
},
{
"role": "assistant",
"content": "SELECT document_type, COUNT(document_id) AS upload_count\nFROM government_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 government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e... |
[
{
"role": "user",
"content": "I want to find all pairs of documents for the same claim where one document is a PDF and the other is an image. Return claim_id, the PDF's document_id as pdf_doc_id, the image's document_id as img_doc_id, and their file names."
},
{
"role": "assistant",
"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 insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "List the block_id, timestamp, and the total amount of transactions for each block, along with the sender and receiver addresses for each transaction that occurred on April 10th, 2023."
},
{
"role": "assistant",
"content": "SELECT b.block_id, b.timestamp, t.sender_ad... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"role": "user",
"content": "Show policy numbers, start dates, and the type of the insurance product for policies with a deductible greater than 500."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T1.start_date, T2.product_type FROM insurance.policies AS T1 JOIN insurance.insur... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"role": "user",
"content": "Show the usernames and email addresses of users who have commented on their own posts."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, u.email\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = u.user_id\nJOIN social_media.pos... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "What is the total USD value of tokens held by CEXes for tokens belonging to the 'DeFi' narrative on the 'Ethereum' chain? Show the narrative, chain, and total value."
},
{
"role": "assistant",
"content": "SELECT T2.narrative, T1.chain, SUM(T1.usd_value) AS total_usd... | You are an SQL statement expert. Given the table 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": "List narratives with a market cap over $1,000,000,000, ordered by market cap descending."
},
{
"role": "assistant",
"content": "SELECT narrative, market_cap FROM narrative_info WHERE market_cap > 1000000000 ORDER BY market_cap 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 narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume... |
[
{
"role": "user",
"content": "List all agents who have sold at least one policy for an insurance product of type 'Health'. For each agent, show their full name, agency name, and the product name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT a.first_name || ' ' || a.last_name AS agent_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 insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "Show me the top 5 narratives by market cap, along with their top 3 coins and 24-hour trading volume."
},
{
"role": "assistant",
"content": "SELECT narrative, top_3_coins, volume_24h FROM narrative_info ORDER BY market_cap DESC LIMIT 5;"
},
{
"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 narrative_info ( narrative character varying(512) NOT NULL, -- the id of narrative top_3_coins text, -- the top 3 token... |
[
{
"role": "user",
"content": "Show me all rooms with their room number, the type name, and the maximum occupancy for each room."
},
{
"role": "assistant",
"content": "SELECT r.room_id, r.room_number, rt.type_name, rt.max_occupancy\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology... | You are an SQL statement expert. Given the table 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": "List the employee full names, the department they work in, and the number of notifications sent to citizens who have made payments for the services managed by these employees' agencies."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show each policy number and the total amount paid for it across all premium payments received so far."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, SUM(T2.amount_paid) FROM insurance.policies AS T1 JOIN insurance.premium_payments AS T2 ON T1.policy... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "For each player, show their player_id, the session_id, and start_time of their very first game session."
},
{
"role": "assistant",
"content": "WITH RankedSessions AS ( SELECT player_id, session_id, start_time, ROW_NUMBER() OVER(PARTITION BY player_id ORDER BY start_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... |
[
{
"role": "user",
"content": "List all users who have made comments that are replies to other comments. Show their user IDs, the comment ID, and the parent comment ID."
},
{
"role": "assistant",
"content": "SELECT user_id, comment_id, parent_comment_id\nFROM social_media.comments\nWHERE parent_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 social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "Show all contracts along with the number of events each contract has emitted. Include the contract address and the event count."
},
{
"role": "assistant",
"content": "SELECT c.address, COUNT(e.event_id) AS event_count\nFROM web3.contracts c\nLEFT JOIN web3.events e ... | You are an SQL statement expert. Given the table 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, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "Show the job title, first name, and last name of all employees who were hired before 2010-01-01."
},
{
"role": "assistant",
"content": "SELECT job_title, first_name, last_name\nFROM government_services.employees\nWHERE hire_date < '2010-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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "For each citizen who has at least one document pending verification and at least one appointment not completed, display the citizen's full name, the document type, the document's upload timestamp, the appointment ID, and the appointment status."
},
{
"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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"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 SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "Find all customers whose email address ends with '@gmail.com'. Please show the customer_id, first name, and email."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, email FROM insurance.customers WHERE email LIKE '%@gmail.com';"
},
{
"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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "Show me all customers who have missing contact information (either phone number or email is null), along with their state and city."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone_number IS NULL 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 insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Find employees who work in the same department as their manager. Display the employee's full name, the manager's full name, and the department they share."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS employee_full_name, m.first... | You are an SQL statement expert. Given the table 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 trips that were delayed by more than 30 minutes, including their vehicle_id, driver_id, and the delay time in minutes."
},
{
"role": "assistant",
"content": "SELECT trip_id, vehicle_id, driver_id, EXTRACT(EPOCH FROM (actual_departure - scheduled_departur... | You are an SQL statement expert. Given the table 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, route_id character varying(64), vehicle_id character var... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.