system stringlengths 319 8.35k | conversations listlengths 2 8 |
|---|---|
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, par... | [
{
"role": "user",
"content": "Which users have commented on posts created by the users they follow? Please show the commenter user_ids and the followed user_ids."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.user_id AS commenter_user_id, f.following_user_id AS followed_user_id FROM so... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birt... | [
{
"role": "user",
"content": "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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointmen... | [
{
"role": "user",
"content": "List all medical records along with the chief complaint and record date for patients who had their medical record created after March 1, 2023 and whose record was created by doctor with ID 'doctor_123'."
},
{
"role": "assistant",
"content": "SELECT record_id, patien... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,... | [
{
"role": "user",
"content": "Show me all ERC20 token contracts that have had at least 200 approvals. Include the token symbol and total approval count."
},
{
"role": "assistant",
"content": "SELECT m.contract_address, m.symbol, COUNT(*) AS approval_count\nFROM erc20_approval a\nJOIN token_metas... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_l... | [
{
"role": "user",
"content": "Count the number of trips for each route type."
},
{
"role": "assistant",
"content": "SELECT R.type, COUNT(T.trip_id) FROM transportation.trips AS T JOIN transportation.routes AS R ON T.route_id = R.route_id GROUP BY R.type;"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, docum... | [
{
"role": "user",
"content": "Show me the count of documents uploaded by each lawyer. Display the uploader ID and the total count of documents."
},
{
"role": "assistant",
"content": "SELECT uploaded_by_lawyer_id, COUNT(*) AS document_count FROM documents GROUP BY uploaded_by_lawyer_id;"
},
{... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, da... | [
{
"role": "user",
"content": "Show me all employees (employee_id, first_name, last_name) in the 'Investment' department who have processed loans (loan_id) with a principal amount greater than $100,000, along with the count of such loans for each employee."
},
{
"role": "assistant",
"content": "S... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifi... | [
{
"role": "user",
"content": "For each user with at least two wallets, calculate the average time difference in hours between consecutive wallet creations. Return user_id and avg_diff_hours."
},
{
"role": "assistant",
"content": "SELECT user_id, AVG(EXTRACT(EPOCH FROM (created_at - prev_created)... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE cex_token_balance ( snapshot_time character varying(32) NOT NULL, -- the snapshot t... | [
{
"role": "user",
"content": "Show me the top 5 tokens by USD value held on the Binance Smart Chain, along with their average price and total balance."
},
{
"role": "assistant",
"content": "SELECT token_symbol, SUM(usd_value) as total_usd_value, AVG(price) as average_price, SUM(balance) as total... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id cha... | [
{
"role": "user",
"content": "Which document types have been used for more than 100 documents, and what is the total file size across all documents of each such type?"
},
{
"role": "assistant",
"content": "SELECT document_type, COUNT(*) AS document_count, SUM(file_size_bytes) AS total_file_size_... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, am... | [
{
"role": "user",
"content": "Find all wallets that hold at least one NFT and also hold ERC-20 tokens."
},
{
"role": "assistant",
"content": "SELECT DISTINCT nh.wallet_address\nFROM nft_holders nh\nJOIN erc20_balances eb\n ON nh.wallet_address = eb.wallet_address;"
},
{
"role": "user",
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi... | [
{
"role": "user",
"content": "Show the number of wallets created for each user. Return user_id and wallet_count."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS wallet_count\nFROM web3.wallets\nGROUP BY user_id;"
},
{
"role": "user",
"content": "Now, can you only s... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, fu... | [
{
"role": "user",
"content": "List all posts that contain the word 'festival' in their content, showing the post_id, the author's username, and the post creation time."
},
{
"role": "assistant",
"content": "SELECT p.post_id, u.username, p.created_at\nFROM social_media.posts p\nJOIN social_media.... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifi... | [
{
"role": "user",
"content": "List all transactions along with the user_id of the sender when the sender’s address matches a wallet. Return transaction_id, from_address, and user_id."
},
{
"role": "assistant",
"content": "SELECT t.transaction_id, t.from_address, w.user_id FROM web3.transactions ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique id... | [
{
"role": "user",
"content": "Can you list all chronic diagnoses made in January 2024, showing diagnosis_id, diagnosis_code, and status, along with the doctor_id who made each diagnosis?"
},
{
"role": "assistant",
"content": "SELECT diagnosis_id, diagnosis_code, status, doctor_id FROM healthcare... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE gaming_technology.in_game_items ( item_id.uuid, game_id.uuid, item_name.text, item_t... | [
{
"role": "user",
"content": "List all items with rarity = 'Legendary', showing item_id, item_name, and cost_amount."
},
{
"role": "assistant",
"content": "SELECT item_id,\n item_name,\n cost_amount\nFROM gaming_technology.in_game_items\nWHERE rarity = 'Legendary';"
},
{
"rol... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen ti... | [
{
"role": "user",
"content": "List all ports along with the count of unique IP addresses that have been seen on each port."
},
{
"role": "assistant",
"content": "SELECT port, COUNT(DISTINCT ip_address) AS unique_ip_count FROM blockchain.nodes GROUP BY port;"
},
{
"role": "user",
"con... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text... | [
{
"role": "user",
"content": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count."
},
{
"role": "assistant",
"content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHE... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -... | [
{
"role": "user",
"content": "I want a report showing each server's name, the game title it hosts, the total number of game_sessions on that server, and the average score in those sessions."
},
{
"role": "assistant",
"content": "SELECT s.server_name, g.title AS game_title, COUNT(gs.session_id) A... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account... | [
{
"role": "user",
"content": "Show me the average interest rate for each account_type."
},
{
"role": "assistant",
"content": "SELECT account_type, AVG(interest_rate) AS average_interest_rate\nFROM financial_services.accounts\nGROUP BY account_type;"
},
{
"role": "user",
"content": "O... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character... | [
{
"role": "user",
"content": "Give me the count of policies grouped by their status."
},
{
"role": "assistant",
"content": "SELECT status,\n COUNT(*) AS policy_count\nFROM insurance.policies\nGROUP BY status;"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.... | [
{
"role": "user",
"content": "Get appointment_id, scheduled_start_time, service_name, location_name, and city for all appointments booked via 'Phone' at accessible locations."
},
{
"role": "assistant",
"content": "SELECT ap.appointment_id, ap.scheduled_start_time, s.service_name, sl.location_nam... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique id... | [
{
"role": "user",
"content": "Get the total number and total amount of invoices issued in 2023."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS invoice_count,\n SUM(total_amount) AS total_amount\nFROM legal_services.invoices\nWHERE issue_date BETWEEN '2023-01-01' AND '2023-12-31'... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name charac... | [
{
"role": "user",
"content": "Show me all clients along with their email addresses who registered in the year 2023."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE EXTRACT(YEAR FROM date_registered) = 2023;"
},
{
"role": "user"... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_i... | [
{
"role": "user",
"content": "Which cities are listed as primary_address for citizens who have a verified account? Can you show the city names and the number of verified citizens in each city?"
},
{
"role": "assistant",
"content": "SELECT SPLIT_PART(primary_address, ',', 1) AS city, COUNT(*) AS ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- un... | [
{
"role": "user",
"content": "Retrieve the document_id, document_type, citizen full name, and verification_status for all documents that have no expiry date set."
},
{
"role": "assistant",
"content": "SELECT d.document_id,\n d.document_type,\n c.first_name || ' ' || c.last_name AS fu... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.employees ( employee_id text, first_name text, last_name text, jo... | [
{
"role": "user",
"content": "Could you list each employee along with their manager’s full name?"
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_name AS manager_name\nFROM financial_services.employees... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.documents ( document_id text, application_id text, citizen_id te... | [
{
"role": "user",
"content": "For each employee who has verified documents, show their full name and the total number of documents they have verified with a status of 'Verified'."
},
{
"role": "assistant",
"content": "SELECT e.full_name, COUNT(d.document_id) FROM government_services.documents d ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi... | [
{
"role": "user",
"content": "Show each token's symbol, token_name, and the deployer_address and status of the contract where that token was created."
},
{
"role": "assistant",
"content": "SELECT t.token_symbol,\n t.token_name,\n c.deployer_address,\n c.status\nFROM web3.tokens... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_y... | [
{
"role": "user",
"content": "Find all pairs of developers who share the exact same founded_year but are from different countries. Show both developer names, their countries, and the founded_year."
},
{
"role": "assistant",
"content": "SELECT d1.name AS developer1_name, d1.country AS country1, d... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birt... | [
{
"role": "user",
"content": "Find patients whose emergency_contact_phone matches another patient's phone_number and show both patients' IDs, full names, and the shared phone number."
},
{
"role": "assistant",
"content": "SELECT p1.patient_id AS contact_of_id,\n p1.first_name || ' ' || p1.... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name te... | [
{
"role": "user",
"content": "Could you provide the booking ID, route number, and fare for all bookings?"
},
{
"role": "assistant",
"content": "SELECT T1.booking_id, T2.route_number, T1.fare FROM transportation.bookings AS T1 JOIN transportation.routes AS T2 ON T1.trip_id = T2.route_id;"
},
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, da... | [
{
"role": "user",
"content": "Calculate the average age of customers grouped by risk_profile."
},
{
"role": "assistant",
"content": "SELECT risk_profile, AVG(EXTRACT(YEAR FROM AGE(current_date, date_of_birth)))::numeric(5,2) AS average_age, COUNT(*) AS customer_count\nFROM financial_services.cus... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_work... | [
{
"role": "user",
"content": "List all invoices with a total_amount less than 1000 and show the associated client's ID and case ID."
},
{
"role": "assistant",
"content": "SELECT invoice_id, client_id, case_id, total_amount\nFROM legal_services.invoices\nWHERE total_amount < 1000;"
},
{
"... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birt... | [
{
"role": "user",
"content": "I want to see a list of all patients, including their full name and date of birth, along with every doctor they have been diagnosed by and that doctor's specialty."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name || ' ' || p.last_name AS pati... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.service_locations (
location_id character varying(64) NOT NU... | [
{
"role": "user",
"content": "Find all service locations in the city of 'Albany' that are accessible. Show their IDs, names, and contact phone numbers along with their address."
},
{
"role": "assistant",
"content": "SELECT location_id, location_name, contact_phone, address FROM government_servic... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_pro... | [
{
"role": "user",
"content": "Give me the website for the insurance plan named 'Family Advantage'."
},
{
"role": "assistant",
"content": "SELECT website FROM healthcare.insurance_plans WHERE plan_name = 'Family Advantage';"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.... | [
{
"role": "user",
"content": "Can you list the names of agencies that do not have a parent agency assigned, ordered by their established date?"
},
{
"role": "assistant",
"content": "SELECT agency_id, agency_name, established_date\nFROM government_services.agencies\nWHERE parent_agency_id IS NULL... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp,... | [
{
"role": "user",
"content": "How many conversations are there where the last message was sent before January 1, 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.conversations WHERE last_message_at < '2024-01-01';"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.insurance_products (
product_id character varying(64) NOT NULL, -- uni... | [
{
"role": "user",
"content": "List all insurance products with a base premium greater than 1000 and less than 5000. Show the product name, product type, and base premium."
},
{
"role": "assistant",
"content": "SELECT product_name, product_type, base_premium FROM insurance.insurance_products WHER... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transacti... | [
{
"role": "user",
"content": "Show me the current ERC20 token balances for the wallet address '0x1A2b3C4dE5f6A7b8C9d0E1f2A3b4C5d6E7f8A9b0'."
},
{
"role": "assistant",
"content": "SELECT contract_address, amount FROM erc20_balances WHERE wallet_address = '0x1A2b3C4dE5f6A7b8C9d0E1f2A3b4C5d6E7f8A9b... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, ... | [
{
"role": "user",
"content": "For each booking, list the booking_id, fare, and the total quantity of fuel consumed on its associated trip."
},
{
"role": "assistant",
"content": "SELECT b.booking_id,\n b.fare,\n SUM(fl.quantity) AS total_fuel_quantity\nFROM transportation.bookings b\n... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique ide... | [
{
"role": "user",
"content": "List the first and last names of all policy beneficiaries who have a percentage_share greater than 50%, ordered by added_at descending."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name\nFROM insurance.policy_beneficiaries\nWHERE percentage_share >... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character var... | [
{
"role": "user",
"content": "Show me the top 3 narratives by trend rank, along with their top 3 coins and 24-hour trading volume from the narrative_info table."
},
{
"role": "assistant",
"content": "SELECT narrative, top_3_coins, volume_24h FROM narrative_info ORDER BY trend_rank ASC LIMIT 3;"
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text... | [
{
"role": "user",
"content": "List the first and last names of all doctors whose email address ends with '@hospital.org'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name FROM healthcare.doctors WHERE email LIKE '%@hospital.org';"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id c... | [
{
"role": "user",
"content": "Show me each staff member and the count of service orders they have delivered."
},
{
"role": "assistant",
"content": "SELECT st.staff_id, st.first_name, st.last_name, COUNT(so.order_id) AS delivered_orders\nFROM hospitality_technology.staff st\nLEFT JOIN hospitality... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character va... | [
{
"role": "user",
"content": "Show me the total number of passengers transported by each vehicle in the last week, along with the vehicle ID."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, SUM(passenger_count) AS total_passengers FROM transportation.trips WHERE status = 'completed' AN... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_n... | [
{
"role": "user",
"content": "For each security sector, calculate the total trading volume and the average closing price from market data for the past year. Include the sector name."
},
{
"role": "assistant",
"content": "SELECT T1.sector, SUM(T2.volume) AS total_volume, AVG(T2.close_price) AS av... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name ... | [
{
"role": "user",
"content": "Show me the first and last names of citizens, the appointment id, and the department of the employee who scheduled their appointment."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, a.appointment_id, e.department\nFROM government_services.ap... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "Get a list of room types along with their property name and the count of rooms currently Available for each type."
},
{
"role": "assistant",
"content": "SELECT rt.type_name, p.property_name, COUNT(r.room_id) AS available_rooms_count\nFROM hospitality_technology.room... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, da... | [
{
"role": "user",
"content": "Retrieve each customer_id, first_name, last_name, and close_price for market_data entries that occurred on the day of their account creation."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name, c.last_name, md.close_price FROM financial_servic... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name charact... | [
{
"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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key t... | [
{
"role": "user",
"content": "List all wallets that were created during the hour of the day which saw the highest number of wallet creations. Show the wallet ID, user ID, address, and creation timestamp."
},
{
"role": "assistant",
"content": "WITH HourlyCounts AS (\n SELECT EXTRACT(HOUR FROM ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.insurance_products (
product_id character varying(64) NOT NULL, -- uni... | [
{
"role": "user",
"content": "Retrieve the product_id, product_name, base_premium, and created_at for all active insurance products with a base_premium greater than 1000, ordered by base_premium descending."
},
{
"role": "assistant",
"content": "SELECT\n product_id,\n product_name,\n base_pre... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE smart_money_profit ( address.text, rank.numeric, profit.numeric, roi.numeric, realiz... | [
{
"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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name charact... | [
{
"role": "user",
"content": "Calculate the average length of the description for each case_type."
},
{
"role": "assistant",
"content": "SELECT case_type,\n AVG(LENGTH(description)) AS avg_desc_length\nFROM legal_services.cases\nGROUP BY case_type;"
},
{
"role": "user",
"conten... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.users ( user_id text, username text, email text, password_hash text, created_at... | [
{
"role": "user",
"content": "Find pairs of users who registered on the same weekday but in different years. List the user ID and registration date for both users, and the weekday name."
},
{
"role": "assistant",
"content": "SELECT u1.user_id, u1.created_at AS user1_created_at, u2.user_id, u2.cr... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, applicat... | [
{
"role": "user",
"content": "How many documents were uploaded in the year 2023?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, sp... | [
{
"role": "user",
"content": "Could you provide a list of each diagnosis, the full name of the doctor who made it, and the name of the insurance plan whose contact phone number matches the doctor's phone number? Please include diagnosis_id, description, doctor full name, and insurance plan name."
},
{
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character vary... | [
{
"role": "user",
"content": "I need a list of all group chat names with every username."
},
{
"role": "assistant",
"content": "SELECT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.conversations c ON 1=1\nWHERE c.is_group_chat = true;"
},
{
"role": "user",
"c... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character vary... | [
{
"role": "user",
"content": "Find all documents that are larger than 5MB. Show the document ID, claim ID, file name, and file size in bytes."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_name, file_size_bytes\nFROM insurance.claim_documents\nWHERE file_size_bytes > 5... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.t... | [
{
"role": "user",
"content": "Show me tokens with a 24-hour trading volume over $1,000,000 from DEX pools that also have a positive net flow from smart money addresses. Display the token symbol, chain, 24h volume, and net flow."
},
{
"role": "assistant",
"content": "SELECT tdi.token_symbol, tdi.... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_... | [
{
"role": "user",
"content": "Show me the number of direct replies each top-level comment has on post 'P200'."
},
{
"role": "assistant",
"content": "SELECT c.comment_id, COUNT(r.comment_id) AS reply_count FROM comments AS c LEFT JOIN comments AS r ON r.parent_comment_id = c.comment_id WHERE c.po... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character... | [
{
"role": "user",
"content": "I need to find all pairs of policies for each customer whose coverage periods overlap. Show customer_id, the two policy_ids for each overlapping pair."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_id,\n p2.policy... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_i... | [
{
"role": "user",
"content": "Show me all users who have liked both a post and a comment. Please include their user IDs, the post IDs, and the comment IDs."
},
{
"role": "assistant",
"content": "SELECT DISTINCT l1.user_id, l1.post_id, l2.comment_id\nFROM social_media.likes l1\nJOIN social_media.... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text... | [
{
"role": "user",
"content": "I need the case_number, client's full name, case_type, and status for all cases."
},
{
"role": "assistant",
"content": "SELECT c.case_number,\n cl.first_name || ' ' || cl.last_name AS client_name,\n c.case_type,\n c.status\nFROM legal_services.case... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text... | [
{
"role": "user",
"content": "For each medication manufacturer, show the total number of distinct generic names they produce."
},
{
"role": "assistant",
"content": "SELECT manufacturer, COUNT(DISTINCT generic_name) AS distinct_generic_name_count FROM healthcare.medications WHERE generic_name IS ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birt... | [
{
"role": "user",
"content": "List all patients who have had appointments and were prescribed a medication manufactured by 'Merck'. Show the patient ID, full name, appointment ID, and medication name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT p.patient_id, p.first_name, p.last_name,... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for... | [
{
"role": "user",
"content": "List events from contract '0xContractA...' that occurred between '2023-01-01' and '2023-01-31'. Show the event ID, event name, and emitted timestamp."
},
{
"role": "assistant",
"content": "SELECT event_id, event_name, emitted_at FROM web3.events WHERE contract_id = ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id.text, customer_id.text, account_number.text... | [
{
"role": "user",
"content": "Summarize the total balance and average interest rate for each account type."
},
{
"role": "assistant",
"content": "SELECT account_type, SUM(balance) AS total_balance, AVG(interest_rate) AS average_interest_rate FROM financial_services.accounts GROUP BY account_type... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text,... | [
{
"role": "user",
"content": "List all guests from California who are loyalty members, including their email and phone number."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email, phone_number FROM hospitality_technology.guests WHERE state_province = 'California'... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, agency_id ... | [
{
"role": "user",
"content": "Provide the count of applications grouped by their status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS application_count\nFROM government_services.applications\nGROUP BY status;"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_na... | [
{
"role": "user",
"content": "I need a list of each case_number and case_name with the total hours spent on each case based on time_entries, but only include cases where the total hours is greater than 10."
},
{
"role": "assistant",
"content": "SELECT c.case_number, c.case_name, SUM(te.hours_spe... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.clients (
client_id character varying(64) NOT NULL, -- unique id... | [
{
"role": "user",
"content": "Show all law firms with more than one partner assigned. Display the law firm name and the number of partners."
},
{
"role": "assistant",
"content": "SELECT lf.firm_name, COUNT(l.lawyer_id) AS partner_count\nFROM legal_services.law_firms lf\nJOIN legal_services.lawye... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2