conversations listlengths 2 8 | system stringlengths 295 8.32k |
|---|---|
[
{
"role": "user",
"content": "Show me all asset types along with the count of distinct assets and the count of log actions for each type."
},
{
"role": "assistant",
"content": "SELECT a.type, COUNT(DISTINCT a.asset_id) AS asset_count, COUNT(l.log_id) AS action_count FROM trading_platform.assets ... | You are an SQL statement expert. Given the table 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 text, name text, symbol text, type text )
CREATE TABLE trading_platform.logs ( log_i... |
[
{
"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 tokens with a price below $1 and a 24-hour trading volume over $5 million."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE price < 1 AND total_volume::numeric > 5000000;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol ch... |
[
{
"role": "user",
"content": "How many group chats have been created since January 1, 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS group_chat_count\nFROM social_media.conversations\nWHERE is_group_chat = TRUE\n AND created_at >= '2024-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u... |
[
{
"role": "user",
"content": "For each route that originates from a location of type 'Port', list the route number, the name of the origin location, and the total distance accumulated from all completed trips on this route."
},
{
"role": "assistant",
"content": "SELECT\n r.route_number,\n l_or... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Show me the total number of items acquired per player for each item type, along with the player's username."
},
{
"role": "assistant",
"content": "SELECT p.player_id, p.username, igi.item_type, SUM(pi.quantity) AS total_acquired\nFROM gaming_technology.player_invent... | You are an SQL statement expert. Given the table 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": "Find all nodes that were last seen in the last 7 days, along with their IP addresses and ports."
},
{
"role": "assistant",
"content": "SELECT node_id, ip_address, port FROM blockchain.nodes WHERE last_seen >= NOW() - INTERVAL '7 days';"
},
{
"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 blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"role": "user",
"content": "Show each user and the count of users who registered before them."
},
{
"role": "assistant",
"content": "SELECT u.username,\n COUNT(prev.user_id) AS earlier_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.users prev\n ON prev.created_at < u.c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "List the subscriber names from patient insurance entries where the group number is not provided (is null)."
},
{
"role": "assistant",
"content": "SELECT subscriber_name FROM healthcare.patient_insurance WHERE group_number IS NULL;"
},
{
"role": "user",
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "I need to identify pairs of verified documents submitted by the same citizen. For each pair, display the citizen_id, the earlier document_id with its verification timestamp, and the later document_id with its verification timestamp."
},
{
"role": "assistant",
"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 government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "List all customers who have policies that expired in the last 30 days."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.customer_id, c.first_name, c.last_name, c.email FROM insurance.customers c JOIN insurance.policies p ON c.customer_id = p.customer_id 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 insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Count the number of logs for each action type."
},
{
"role": "assistant",
"content": "SELECT action,\n COUNT(*) AS count\nFROM trading_platform.logs\nGROUP BY action;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
|
[
{
"role": "user",
"content": "Show me a list of all appointments with the subject and full name of the assigned lawyer."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.subject, l.first_name || ' ' || l.last_name AS lawyer_full_name\nFROM legal_services.appointments a\nJOIN lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Find pairs of token transfers within the same transaction and for the same token, where the value of one transfer is exactly twice the value of the other. Show the transaction ID, token ID, and both transfer IDs and their values."
},
{
"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 web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "For each Bitcoin token tick, show me the creator address from the token_info_bitcoin table and the number of unique wallets currently holding that token."
},
{
"role": "assistant",
"content": "SELECT ti.tick, ti.creator, COUNT(DISTINCT tb.wallet_address) AS unique_w... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "I want to list all insurance plans along with the number of medical records that have a record_date in 2024. Display plan_id, plan_name, and the total medical records."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id, ip.plan_name, COUNT(mr.record_id) AS tot... | You are an SQL statement expert. Given the table 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 the list of hashtags that have been used, along with the time they were first used."
},
{
"role": "assistant",
"content": "SELECT tag_name, created_at \nFROM social_media.hashtags;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List the contact phone and website for all insurance plans provided by 'Continental Health'."
},
{
"role": "assistant",
"content": "SELECT plan_name, contact_phone, website\nFROM healthcare.insurance_plans\nWHERE insurance_provider = 'Continental Health';"
}
] | You are an SQL statement expert. Given the table 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": "Find all room types that have 'sofa' mentioned in their amenities."
},
{
"role": "assistant",
"content": "SELECT * FROM hospitality_technology.room_types WHERE amenities LIKE '%sofa%'"
},
{
"role": "user",
"content": "Also include the max_occupancy and f... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "List the first name, last name, license number, and status for all drivers whose license expires in the next 6 months."
},
{
"role": "assistant",
"content": "SELECT\n first_name,\n last_name,\n license_number,\n status\nFROM transportation.drivers\nWHERE\n lice... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "Show me all claims with police reports that were handled by agents hired in the last 2 years, along with the agent's full name and agency."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, c.incident_date, c.police_report_number, CONCAT(a.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 insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "Find all pairs of different insurance records that share the same group_number, and show group_number, the patient_insurance_id of both records, and their corresponding patient_ids."
},
{
"role": "assistant",
"content": "SELECT a.group_number,\n a.patient_insu... | You are an SQL statement expert. Given the table 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 text, patient_id text, plan_id text, policy_number text, group_numb... |
[
{
"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": "What are the safety ratings or crash statistics for the Boeing 787 Dreamliner?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to safety ratings or crash statistics for specific aircraft models like the Boeing 787 Dreamliner. My data is lim... | 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": "I need a count of appointments per patient that took place between '2024-04-01' and '2024-04-30', showing patient_id, first_name, last_name, and the total number of appointments."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.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.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Show me all users who have wallets but have never placed any orders, along with their wallet addresses and creation dates."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, w.address AS wallet_address, w.created_at FROM trading_platform.users u JOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "Show me the top 5 users by the total number of trades they participated in as buyers, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, w.address, COUNT(t.trade_id) AS trade_count FROM trading_platform.users u JO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Find all smart contracts where the code length is greater than 1000 characters."
},
{
"role": "assistant",
"content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE LENGTH(code) > 1000;"
},
{
"role": "user",
"conten... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.smart_contracts ( contract_id text PRIMARY KEY, creator_address text, code text, timestamp timestamp )
|
[
{
"role": "user",
"content": "List the full name (first name and last name) of all citizens who have uploaded documents whose expiry date is in the past."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name FROM government_services.citizens AS T1 INNER JOIN governme... | You are an SQL statement expert. Given the table 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 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": "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": "Count the number of posts that have a media URL but no textual content."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.posts AS T1 WHERE T1.media_url IS NOT NULL AND (T1.content IS NULL OR T1.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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Show me all users whose email address contains the word 'test', along with their user IDs and the date they registered."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email, created_at FROM trading_platform.users WHERE email ILIKE '%test%';"
},
... | You are an SQL statement expert. Given the table 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 game titles released on the 'PC' platform along with the count of servers currently hosting each game."
},
{
"role": "assistant",
"content": "SELECT T1.title, count(T2.server_id) FROM games AS T1 JOIN servers AS T2 ON T1.game_id = T2.game_id WHERE T1.platform =... | You are an SQL statement expert. Given the table 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(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "List the document ID, document type, and the full name of the citizen who submitted the document, but only for documents submitted for applications with a status of 'Approved'."
},
{
"role": "assistant",
"content": "SELECT T1.document_id, T1.document_type, T3.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.documents ( document_id.text, application_id.text, citizen_id.text, document_type.text, file_refere... |
[
{
"role": "user",
"content": "For the 'DeFi' narrative, what is the average ROI and the total net inflow (usd_value where type=1) from smart money token inflow?"
},
{
"role": "assistant",
"content": "SELECT AVG(sm.roi) AS avg_roi, SUM(smt.usd_value) AS total_net_inflow\nFROM smart_money_token_in... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "Show me wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount, sorted by amount in descending order."
},
{
"role": "assistant",
"content": "SELECT b.wallet_address, t.symbol, b.amount FROM erc20_balances b JOIN sui_coin... | You are an SQL statement expert. Given the table 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": "List all pairs of diagnoses that belong to the same medical record. Show record_id, diagnosis_id from the first entry as diag1_id, and diagnosis_id from the second entry as diag2_id."
},
{
"role": "assistant",
"content": "SELECT d1.record_id,\n d1.diagnosis_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "Show me all insurance plans that have more than 5 patients enrolled as their primary insurance, along with the provider name and count of patients, sorted by patient count in descending order."
},
{
"role": "assistant",
"content": "SELECT ip.insurance_provider, ip.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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "List all managers (employees who have other employees reporting to them) along with the count of their direct reports, showing only those with more than 5 reports."
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name, e.last_name, COUNT(r.employ... | You are an SQL statement expert. Given the table 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.employees ( employee_id text PRIMARY KEY, first_name text, last_name text, job_title text, departmen... |
[
{
"role": "user",
"content": "Show all likes made by user 'U555' on comments, including the comment_id and like creation time."
},
{
"role": "assistant",
"content": "SELECT like_id, comment_id, created_at\nFROM social_media.likes\nWHERE user_id = 'U555' AND comment_id IS NOT NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "Find all addresses that have only sent tokens (appear in from_address) but have never received any (do not appear in to_address)."
},
{
"role": "assistant",
"content": "SELECT DISTINCT from_address FROM web3.token_transfers WHERE from_address NOT IN (SELECT DISTINCT... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with the count of available rooms at each property."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, p.city, p.star_rating, COUNT(r.room_id) AS available_rooms_coun... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Show me all insurance plans that have more than 5 patients enrolled as their primary insurance, along with the provider name and count of patients."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id, ip.plan_name, ip.insurance_provider, COUNT(pi.patient_id) 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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "Count the number of registered citizens by gender."
},
{
"role": "assistant",
"content": "SELECT\n gender,\n COUNT(*) AS citizen_count\nFROM government_services.citizens\nGROUP BY gender;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "Show me the user who created the most wallets, along with the count of wallets they created and their email address."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(w.wallet_id) AS wallet_count FROM trading_platform.users u JOIN trading_platf... | You are an SQL statement expert. Given the table 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": "For each vehicle, show the vehicle_id, license_plate, date of its most recent trip (actual_arrival), and the odometer_reading at its latest maintenance service."
},
{
"role": "assistant",
"content": "SELECT\n v.vehicle_id,\n v.license_plate,\n (\n SE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "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": "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": "Show me the number of approval-for-all events for each ERC1155 contract in the erc1155_approval_for_all table."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_address;"
},
... | You are an SQL statement expert. Given the table 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 total trade amount for each account. Include the account_id and account_number."
},
{
"role": "assistant",
"content": "SELECT\n T1.account_id,\n T1.account_number,\n SUM(T2.total_amount) AS total_traded_amount\nFROM financial_services.accounts AS T1\nINN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Show each citizen's first and last notification IDs based on sent_at."
},
{
"role": "assistant",
"content": "WITH bounds AS (\n SELECT citizen_id,\n MIN(sent_at) AS first_sent,\n MAX(sent_at) AS last_sent\n FROM government_services.notifications\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 government_services.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_sub... |
[
{
"role": "user",
"content": "List pairs of drivers whose license expiry dates fall within 30 days of each other. Show both driver_ids, names, and the two expiry dates."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id, d1.first_name AS driver1_first, d1.last_name AS drive... | You are an SQL statement expert. Given the table 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": "Show the total number of policies in each status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) FROM insurance.policies GROUP BY 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.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "How many hashtags have been created in March 2024?"
},
{
"role": "assistant",
"content": "```sql\nSELECT COUNT(*) AS march_2024_hashtag_count\nFROM social_media.hashtags\nWHERE created_at >= '2024-03-01'\n AND created_at < '2024-04-01';\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.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Return the count of comments for each hashtag."
},
{
"role": "assistant",
"content": "SELECT ph.hashtag_id,\n h.tag_name,\n COUNT(c.comment_id) AS comment_count\nFROM social_media.post_hashtags ph\nJOIN social_media.hashtags h\n ON ph.hashtag_id = h.has... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "What is the current job satisfaction level or feedback from staff members working at a specific train station?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on job satisfaction levels or feedback from staff members as this data is... | 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.s... |
[
{
"role": "user",
"content": "List all posts where the content mentions 'meeting'."
},
{
"role": "assistant",
"content": "SELECT post_id, user_id, content, created_at FROM social_media.posts WHERE content LIKE '%meeting%'"
},
{
"role": "user",
"content": "Also, only include those 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.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "For each citizen who has made at least one payment, show the citizen's full name, number of payments, and total amount paid, grouped by currency."
},
{
"role": "assistant",
"content": "SELECT\n c.first_name || ' ' || c.last_name AS full_name,\n p.currency,\n COUN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "List all auto loans (loan_id, principal_amount, interest_rate) where the current principal balance is less than 40% of the original principal amount, along with the account_id and the difference between principal_amount and current_principal_balance."
},
{
"role": "assi... | You are an SQL statement expert. Given the table 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.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2