conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "List all appointments that are currently scheduled and show their appointment time."
},
{
"role": "assistant",
"content": "SELECT appointment_id, patient_id, doctor_id, appointment_time FROM healthcare.appointments WHERE status = 'Scheduled';"
}
] | 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": "Show me all active staff members with their property_id, position, and hire_date."
},
{
"role": "assistant",
"content": "SELECT staff_id, property_id, position, hire_date FROM hospitality_technology.staff WHERE is_active = true;"
},
{
"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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "List all insurance plans along with their provider, plan type, and the contact phone number. Also, for each plan, show how many doctors have their hospital affiliation ID matching the plan ID."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id, ip.plan_name, i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "Find the top 3 transactions by total transfer value (sum of all transfers in the transaction), showing the transaction_id and total value."
},
{
"role": "assistant",
"content": "SELECT transaction_id, SUM(value) as total_value FROM web3.token_transfers GROUP BY tran... | 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, token_id.text, from_address.text, to_address.text, value.numeric, transaction_... |
[
{
"role": "user",
"content": "Show me for each user how many conversations they've participated in, include their email and conversation count, only for those who have participated in more than five conversations."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(DISTINCT m... | 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 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": "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": "How many users have push notifications disabled?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS user_count\nFROM social_media.user_settings\nWHERE push_notifications_enabled = 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 social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "Find pairs of wallet IDs that belong to the same user, showing the user ID and the two wallet IDs."
},
{
"role": "assistant",
"content": "SELECT w1.user_id, w1.wallet_id AS wallet1_id, w2.wallet_id AS wallet2_id FROM web3.wallets w1 JOIN web3.wallets w2 ON w1.user_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "For narratives listed in `narrative_info`, find the total USD value held by CEXes for tokens that are among their top 3 listed coins. Show the narrative and the total CEX USD value."
},
{
"role": "assistant",
"content": "SELECT T2.narrative, SUM(T1.usd_value) 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 narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"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 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 character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "For projects that have completed more than one fundraising round, calculate the average investment value across all their recorded rounds. Display the project name and this average value."
},
{
"role": "assistant",
"content": "SELECT project_name, AVG(investment_val... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "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": "Show me all notifications that are related to posts created by users who have a verified profile. Include the notification type, the recipient username, and the post ID."
},
{
"role": "assistant",
"content": "SELECT\n n.notification_type,\n u_recipient.username 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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List all available rooms with their room number, property_name, type_name, and the number of days since they were last cleaned."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n r.room_number,\n rt.type_name,\n date_part('day', curre... | 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": "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": "How many achievements has each player unlocked and what's the earliest unlocked timestamp for each?"
},
{
"role": "assistant",
"content": "SELECT player_id,\n COUNT(*) AS total_unlocked,\n MIN(unlocked_at) AS first_unlocked\nFROM gaming_technology.player... | 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.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti... |
[
{
"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": "Find narrative pairs where the sum of their price_change_percentage_1h is greater than 5. Show narrative1, change1, narrative2, change2, and the sum as total_change."
},
{
"role": "assistant",
"content": "SELECT n1.narrative AS narrative1, n1.price_change_percentage... | 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": "Which diagnosis codes have been used for more than 5 different patients? Show the diagnosis_code and the patient count."
},
{
"role": "assistant",
"content": "SELECT diagnosis_code, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.diagnoses GROUP BY diagn... | 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": "For each game, show the game title, the total duration of all sessions in seconds, and the average score."
},
{
"role": "assistant",
"content": "SELECT g.title, SUM(gs.duration_seconds) AS total_duration_seconds, AVG(gs.score) AS average_score FROM gaming_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 gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "Find pairs of servers in the same region where one server's current_players is more than twice that of another. Return the region, server1 name, server2 name, and their current_players counts."
},
{
"role": "assistant",
"content": "SELECT s1.region,\n s1.serve... | 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.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,... |
[
{
"role": "user",
"content": "How many diagnoses does each status have grouped by is_chronic flag?"
},
{
"role": "assistant",
"content": "SELECT is_chronic, status, COUNT(*) AS count FROM healthcare.diagnoses GROUP BY is_chronic, 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 healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty... |
[
{
"role": "user",
"content": "Can you show me the total amount paid by each citizen for each service? Please display the citizen_id, service_id, and the total amount."
},
{
"role": "assistant",
"content": "SELECT citizen_id, service_id, SUM(amount) AS total_amount\nFROM government_services.payme... | 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.payments ( payment_id text PRIMARY KEY, application_id text, citizen_id text, service_id text, amou... |
[
{
"role": "user",
"content": "List all appointment IDs and their corresponding location IDs for appointments that have status 'cancelled'."
},
{
"role": "assistant",
"content": "SELECT appointment_id, location_id FROM healthcare.appointments WHERE status = 'cancelled';"
}
] | 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 character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "How many customers have the risk profile 'High' and live in New York state?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS high_risk_customers\nFROM financial_services.customers\nWHERE risk_profile = 'High' AND state = 'NY';"
},
{
"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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"role": "user",
"content": "我想查询某个特定组件ID的详细信息,包括组件名称、材料名称、材料密度以及供应商ID,同时还需要知道该组件在哪个装配线上的飞机型号ID。"
},
{
"role": "assistant",
"content": "SELECT c.component_id, c.component_name, m.material_name, m.density_kg_m3, c.supplier_id, al.aircraft_model_id\nFROM manufacturing.components c\nJOIN manufactu... | 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 manufacturing.components (
component_id character varying(64) NOT NULL, -- uniqu... |
[
{
"role": "user",
"content": "Show me all open cases along with the case number, the client's full name, and the name and email of the lead lawyer."
},
{
"role": "assistant",
"content": "SELECT c.case_number, cl.first_name || ' ' || cl.last_name AS client_full_name, l.first_name || ' ' || l.last... | 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 each claim with its policy number and the selling agent's first and last name."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, p.policy_number, a.first_name, a.last_name\nFROM insurance.claims c\nJOIN insurance.policies p ON c.policy_id = p.policy_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 insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "I want a list of each department's top 3 longest-tenured active employees, showing their full names, hire_date, and their manager’s full names."
},
{
"role": "assistant",
"content": "WITH ranked AS (\n SELECT\n e.department,\n e.employee_id,\n e.first_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 financial_services.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit... |
[
{
"role": "user",
"content": "Can you show me the number of unique item types and the average cost amount for each game?"
},
{
"role": "assistant",
"content": "SELECT game_id, COUNT(DISTINCT item_type) AS unique_item_types, AVG(cost_amount) AS avg_cost_amount FROM gaming_technology.in_game_items... | 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.in_game_items ( item_id uuid, game_id uuid, item_name text, item_type text, description text, rarity ... |
[
{
"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 property, show the property name, average price of available services, and the maximum price of available services."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n AVG(s.price) AS avg_price,\n MAX(s.price) AS max_price\nFROM hos... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "Which law firms were founded in the same year and share the same managing partner? Show the firm names, founding year, and managing partner ID."
},
{
"role": "assistant",
"content": "SELECT f1.firm_name AS firm_name_1, f2.firm_name AS firm_name_2, EXTRACT(YEAR FROM ... | 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 PRIMARY KEY, firm_name text, address text, phone text, website text, founded_da... |
[
{
"role": "user",
"content": "List all diagnoses made in the last month including diagnosis_date, patient full name, doctor's full name, and description."
},
{
"role": "assistant",
"content": "SELECT d.diagnosis_date,\n p.first_name || ' ' || p.last_name AS patient_name,\n doc.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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"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": "For every manufacturer, show the total number of medications they produce, and the number of those that have an NDC code starting with '5'."
},
{
"role": "assistant",
"content": "SELECT manufacturer, COUNT(*) AS total_medications, COUNT(CASE WHEN ndc_code LIKE '5%' ... | 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.medications (
medication_id character varying(64) NOT NULL, -- unique identifier for the medication type... |
[
{
"role": "user",
"content": "Show me the full names and contact emails of citizens who have received notifications via 'SMS'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name, c.last_name, c.contact_email\nFROM government_services.citizens c\nJOIN government_services.notifica... | 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": "How many sessions have been hosted per server, showing server_name and session_count?"
},
{
"role": "assistant",
"content": "SELECT s.server_name,\n COUNT(gs.session_id) AS session_count\nFROM gaming_technology.servers s\nLEFT JOIN gaming_technology.game_sessi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_year.integer, website.text, created_... |
[
{
"role": "user",
"content": "List all rooms that are currently in 'Maintenance' status, including their room numbers and current conditions."
},
{
"role": "assistant",
"content": "SELECT room_number, current_condition FROM hospitality_technology.rooms WHERE status = '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.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "For each case type, calculate the average time to close cases in days, only including cases that have been closed."
},
{
"role": "assistant",
"content": "SELECT case_type,\n AVG(EXTRACT(EPOCH FROM (date_closed - date_opened)) / 86400) AS avg_close_days\nFROM l... | 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": "For each customer, could you list their full name, email, and the combined balance of all their accounts? Please also show the number of accounts they hold."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name || ' ' || c.last_name AS full_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 financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Show the first name, last name, and email of customers who have filed a claim, along with the status and estimated loss of each claim."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.email, T2.status, T2.estimated_loss FROM insurance.cu... | 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": "Which employees have verified more than 5 documents in the last 30 days? Return the employee's full name, department, and the number of verifications."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS full_name, e.department, COUNT(... | 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.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "List the peer IDs and IP addresses for all peers where the port is greater than 1024."
},
{
"role": "assistant",
"content": "SELECT peer_id, ip_address \nFROM trading_platform.peers \nWHERE port > 1024"
}
] | 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, name character varying(128) NOT NULL, symbol charact... |
[
{
"role": "user",
"content": "For each chain, which centralized exchange holds the largest total USD value in their token balance as of the most recent snapshot?"
},
{
"role": "assistant",
"content": "WITH latest_snapshot AS (\n SELECT MAX(snapshot_time) AS max_time FROM cex_token_balance\n)\nS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "List each user's username, email, and the total count of log entries they have recorded."
},
{
"role": "assistant",
"content": "SELECT T1.username, T1.email, count(T2.log_id) FROM users AS T1 LEFT JOIN logs AS T2 ON T1.user_id = T2.user_id GROUP BY T1.user_id, T1.us... | 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": "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": "能否帮我统计特定车站(station_id 为 'station_xyz')的所有工作人员数量?"
},
{
"role": "assistant",
"content": "MATCH (s:Station {station_id: 'station_xyz'})<-[:BASED_AT]-(staff:Staff)\nRETURN COUNT(staff) AS total_staff"
}
] | 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
// Node Label: :Station
// Properties:
// station_id: String (Constraint: UNIQUE)
// station_... |
[
{
"role": "user",
"content": "For each employee, show their first and last name and the number of documents they have verified."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, COUNT(d.document_id) AS verified_documents_count\nFROM government_services.employees e\nJOIN go... | 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": "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": "I need to compare consecutive daily close_prices for each security to find when the close_price increased compared to the previous day."
},
{
"role": "assistant",
"content": "SELECT a.security_id, b.data_timestamp AS prev_date, b.close_price AS prev_close, a.data_ti... | 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": "Show me the total number of bookings and total fare collected per trip. Only include trips that have collected more than 500 in total fare."
},
{
"role": "assistant",
"content": "SELECT trip_id, COUNT(*) AS booking_count, SUM(fare) AS total_fare\nFROM transportation... | 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.bookings (
booking_id character varying(64) NOT NULL, -- unique identifier for the booking
pass... |
[
{
"role": "user",
"content": "Which DEX tokens currently have a negative price change over the last hour and a trading volume above $100,000?"
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, chain, price_change_percentage_1h, volume_24h\nFROM token_dexpool_info\nWHERE pric... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Show the first name, last name, and email for guests residing in California."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM hospitality_technology.guests WHERE state_province = 'CA'"
},
{
"role": "user",
"content": "Only ... | 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": "List all appointments with status 'Completed' that were created in the last 30 days."
},
{
"role": "assistant",
"content": "SELECT * FROM healthcare.appointments WHERE status = 'Completed' AND created_at >= NOW() - INTERVAL '30 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 healthcare.appointments ( appointment_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "Show me all active managers along with their first and last names, and the count of staff members they supervise, ordered by the supervised staff count in descending order."
},
{
"role": "assistant",
"content": "SELECT s1.staff_id, s1.first_name, s1.last_name, COUNT... | 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, -- unique identifier for the staff member
... |
[
{
"role": "user",
"content": "Which tokens have the highest liquidity on the Ethereum chain and what are their current prices and 24-hour trading volumes?"
},
{
"role": "assistant",
"content": "SELECT token_symbol, price, liquidity, volume_24h FROM token_dexpool_info WHERE chain = 'Ethereum' ORD... | 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_dexpool_info ( pair_address.text, token_name.text, token_symbol.text, chain.text, price.numeric, price_change_per... |
[
{
"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 passenger records were created in the year 2023?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM transportation.passengers WHERE EXTRACT(YEAR FROM created_at) = 2023;"
},
{
"role": "user",
"content": "What about the number of passeng... | 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.passengers (
passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger
... |
[
{
"role": "user",
"content": "Show me the document ID, file name, document type, and the status of the claim it belongs to, for all documents uploaded by agents whose license state is 'NY'."
},
{
"role": "assistant",
"content": "SELECT cd.document_id, cd.file_name, cd.document_type, c.status FRO... | 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 character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "I want to know, for each conversation participant, how many unread messages they have. Return participant_id, conversation_id, and unread_count."
},
{
"role": "assistant",
"content": "SELECT cp.participant_id,\n cp.conversation_id,\n COUNT(m.message_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.posts (
post_id character varying(64) NOT NULL, -- unique identifier for the post
user_id characte... |
[
{
"role": "user",
"content": "Show me all claim documents that are medical reports and were uploaded in the last 3 months, along with their file sizes and claim IDs."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_size_bytes, uploaded_at FROM insurance.claim_documents 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 insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "Show me all home loans (loan_id, principal_amount, interest_rate) where the current principal balance is more than 75% of the original principal amount, along with the account_id and employee details (first_name, last_name) of the employee who processed the loan application."
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions ( transaction_id.text, account_id.text, related_account_id.text, transaction_type.text,... |
[
{
"role": "user",
"content": "List all prescriptions with the corresponding patient's emergency contact name and phone number. Show prescription ID, patient full name, emergency contact name, and emergency contact phone."
},
{
"role": "assistant",
"content": "SELECT pr.prescription_id, p.first_n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "List users who have received notifications triggered by another user (non-system notifications). Show the recipient username, notification type, and the sender username."
},
{
"role": "assistant",
"content": "SELECT T1.username AS recipient_username, T2.notification... | 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": "How many likes has post 'P789' received in total?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS total_likes\nFROM social_media.likes\nWHERE post_id = 'P789';"
}
] | 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": "Retrieve all reservations and the full name of the guest who made each reservation."
},
{
"role": "assistant",
"content": "SELECT T1.reservation_id, T2.first_name, T2.last_name FROM hospitality_technology.reservations AS T1 INNER JOIN hospitality_technology.guests A... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city.... |
[
{
"role": "user",
"content": "Can you list each developer's name along with the number of games they have published by joining developers and games?"
},
{
"role": "assistant",
"content": "SELECT d.name AS developer_name,\n COUNT(g.game_id) AS games_published\nFROM gaming_technology.develop... | 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": "Retrieve all pairs of loans for the same account where both loans are active and have different loan types. Show account_id, loan_id as loan_a, loan_type as type_a, loan_id as loan_b, and loan_type as type_b."
},
{
"role": "assistant",
"content": "SELECT a.account_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans (
loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same... |
[
{
"role": "user",
"content": "Can you list each citizen's first and last name, contact email, and the total amount they have paid for succeeded payments?"
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, c.contact_email, SUM(p.amount) AS total_paid FROM government_services... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List all appointments along with the patient's full name and the doctor's full name."
},
{
"role": "assistant",
"content": "SELECT\n a.appointment_id,\n a.appointment_time,\n p.first_name AS patient_first_name,\n p.last_name AS patient_last_name,\n d.first_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": "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": "Show me how many achievements each player has unlocked."
},
{
"role": "assistant",
"content": "SELECT player_id,\n COUNT(*) AS total_unlocked\nFROM gaming_technology.player_achievements\nGROUP BY player_id;"
},
{
"role": "user",
"content": "Now onl... | 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.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N... |
[
{
"role": "user",
"content": "List the usernames and emails of users who have sent at least one notification."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username, T1.email FROM social_media.users AS T1 JOIN social_media.notifications AS T2 ON T1.user_id = T2.sender_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.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List all metadata entries showing the metadata_id, asset_id, key, and value."
},
{
"role": "assistant",
"content": "SELECT metadata_id, asset_id, key, value FROM metadata"
}
] | 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 the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their token symbol and narrative."
},
{
"role": "assistant",
"content": "SELECT token_symbol, narrative, usd_value FROM smart_money_token_inflow WHERE type = 1 ORDER 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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "List all reviews for properties with a star rating of at least 4.5. Include the property_name, review_id, rating_overall, and review_date."
},
{
"role": "assistant",
"content": "SELECT p.property_name, r.review_id, r.rating_overall, r.review_date\nFROM hospitality_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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "I want to list all pairs of customers living in the same city with different risk profiles."
},
{
"role": "assistant",
"content": "SELECT a.customer_id AS customer_a,\n b.customer_id AS customer_b,\n a.city,\n a.risk_profile AS risk_a,\n b.ri... | 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": "Show me the total transaction amount sent by each sender address, along with their current balance from the addresses table."
},
{
"role": "assistant",
"content": "SELECT t.sender_address, SUM(t.amount) AS total_sent, a.balance FROM blockchain.transactions t JOIN bl... | 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 PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... |
[
{
"role": "user",
"content": "For each Avalanche token tick, show me the creator from the `token_info_avalanche` table and the total number of activities recorded for that tick in the `token_activities` table."
},
{
"role": "assistant",
"content": "SELECT ti.tick, ti.creator, COUNT(ta.tx_hash) A... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"role": "user",
"content": "I need a report showing each active customer's full name and email, along with the number of loans they have and the total principal amount across those loans."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name,\n c.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 financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "List policy IDs and policy numbers for policies that have a null cancellation reason."
},
{
"role": "assistant",
"content": "SELECT policy_id, policy_number FROM insurance.policies WHERE cancellation_reason IS 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 insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"role": "user",
"content": "How many users registered in each month?"
},
{
"role": "assistant",
"content": "SELECT date_trunc('month', created_at) AS month,\n COUNT(*) AS registrations\nFROM web3.users\nGROUP BY month\nORDER BY month;"
},
{
"role": "user",
"content": "Actuall... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(... |
[
{
"role": "user",
"content": "Show me all reservations with their guest IDs and room IDs where the total amount is greater than $300, along with the service names and prices of any services ordered for those reservations."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, r.guest_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 hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "List all pairs of vehicles from the same depot that have different fuel types. Include vehicle1_id, fuel_type1, vehicle2_id, fuel_type2, and the depot_id."
},
{
"role": "assistant",
"content": "SELECT v1.vehicle_id AS vehicle1_id, v1.fuel_type AS fuel_type1, v2.vehi... | 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, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "Show me all insurance products with 'auto' in their product type, along with their coverage details."
},
{
"role": "assistant",
"content": "SELECT product_name, coverage_details FROM insurance.insurance_products WHERE product_type LIKE '%auto%';"
},
{
"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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "List all transactions that involve token transfers, along with the token names and the contract addresses where these tokens are deployed."
},
{
"role": "assistant",
"content": "SELECT t.transaction_id, t.from_address, t.to_address, tk.token_name, tk.contract_addres... | 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 payments processed in USD, showing payment_id, guest_id, amount, and payment_timestamp."
},
{
"role": "assistant",
"content": "SELECT payment_id,\n guest_id,\n amount,\n payment_timestamp\nFROM hospitality_technology.payments\nWHERE curren... | 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.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu... |
[
{
"role": "user",
"content": "List all spa services (category = 'Wellness') with their names, prices, and units, ordered by price in descending order."
},
{
"role": "assistant",
"content": "SELECT service_name, price, unit FROM hospitality_technology.services WHERE category = 'Wellness' ORDER 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 hospitality_technology.guests (
guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil... |
[
{
"role": "user",
"content": "List each doctor and the total number of unique patients for appointments that have been completed. Return doctor_id, first_name, last_name, and patient_count."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id,\n d.first_name,\n d.last_name,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "Show product_id, product_name, and base_premium for the five most recently created active insurance products."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, base_premium\nFROM insurance.insurance_products\nWHERE is_active = true\nORDER BY cr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "Please list the full name and status of clients who have not provided a company name."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, status\nFROM legal_services.clients\nWHERE company_name IS 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 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 all trades (trade_id, security_id, total_amount) executed by employees in the 'Investment' department, along with their employee_id and first_name."
},
{
"role": "assistant",
"content": "SELECT t.trade_id, t.security_id, t.total_amount, e.employee_id, e.firs... | 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.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.... |
[
{
"role": "user",
"content": "Find all metadata entries where the key is 'token_name' and display the asset_id along with its value."
},
{
"role": "assistant",
"content": "SELECT asset_id, value\nFROM trading_platform.metadata\nWHERE key = 'token_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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "Find pairs of distinct routes that share the same destination location but start from different origins. Include the route ID and route number for both routes and the shared destination location ID."
},
{
"role": "assistant",
"content": "SELECT\n r1.route_id AS rou... | 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, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "List all active policies for 'home' insurance products, including policy number, product name, and the first and last name of the agent who sold it."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T2.product_name, T3.first_name, T3.last_name FROM pol... | 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 character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "Show me all service orders placed before 2023-01-01, including order ID, guest ID, and order timestamp."
},
{
"role": "assistant",
"content": "SELECT order_id, guest_id, order_timestamp FROM hospitality_technology.service_orders WHERE order_timestamp < '2023-01-01';... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id text, reservation_id text, guest_id text, service_id text, staff_id_or... |
[
{
"role": "user",
"content": "List the service names, agency names, and standard fees for all services that are active and have a standard fee between 50 and 100 inclusive."
},
{
"role": "assistant",
"content": "SELECT s.service_name, ag.agency_name, s.standard_fee\nFROM government_services.serv... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "I want a list of DApp names and the asset symbols mentioned in their descriptions."
},
{
"role": "assistant",
"content": "SELECT d.name AS dapp_name,\n a.symbol AS asset_symbol\nFROM trading_platform.dapps d\nJOIN trading_platform.assets a\n ON d.description ... | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.