conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "For each block number, show the minimum transaction value and the transaction_id(s) that have that minimum value."
},
{
"role": "assistant",
"content": "SELECT t.block_number, t.transaction_id, t.value\nFROM web3.transactions t\nINNER JOIN (\n SELECT block_number, ... | You are an SQL statement expert. Given the table 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": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts, and show their network IDs and deployment timestamps."
},
{
"role": "assistant",
"content": "SELECT address, network_id, deployed_at FROM web3.cont... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Find all pairs of payments for the same reservation where the statuses differ."
},
{
"role": "assistant",
"content": "SELECT p1.payment_id AS payment_id_1,\n p2.payment_id AS payment_id_2,\n p1.reservation_id,\n p1.status AS status_1,\n p2.st... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, reservation_id character varying(64), gues... |
[
{
"role": "user",
"content": "Find the total quantity dispensed and the number of refills allowed for each dosage type."
},
{
"role": "assistant",
"content": "SELECT dosage, SUM(quantity_dispensed) AS total_quantity_dispensed, SUM(refills_allowed) AS total_refills_allowed FROM healthcare.prescri... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, pa... |
[
{
"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 SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "Show me a list of all policy numbers that have a deductible exactly equal to 0."
},
{
"role": "assistant",
"content": "SELECT policy_number\nFROM insurance.policies\nWHERE deductible = 0;"
}
] | You are an SQL statement expert. Given the table 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, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "List all active services whose average processing time exceeds the overall average processing time across all active services. Show the service_id, service_name, its average_processing_time_days, and the overall average_processing_time."
},
{
"role": "assistant",
"c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eli... |
[
{
"role": "user",
"content": "What is the average number of days by which paid invoices were paid late? Calculate the average of (payment_date - due_date) for invoices with status 'Paid'."
},
{
"role": "assistant",
"content": "SELECT AVG((payment_date::date - due_date)) AS average_late_days\nFRO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id character varying(64) NOT NULL, invoice_number character varying(100) UNIQUE NOT N... |
[
{
"role": "user",
"content": "Provide the total count of UTXOs grouped by their spent status."
},
{
"role": "assistant",
"content": "SELECT spent, COUNT(*) AS utxo_count\nFROM trading_platform.utxos\nGROUP BY spent;"
}
] | You are an SQL statement expert. Given the table 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.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan... |
[
{
"role": "user",
"content": "List all active staff members (is_active = true) along with their position and hire date, ordered by hire date from newest to oldest."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, position, hire_date FROM hospitality_technology.staff WHERE is_... | You are an SQL statement expert. Given the table 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": "Find pairs of time entries for the same invoice where one entry is billed and the other is not."
},
{
"role": "assistant",
"content": "SELECT a.invoice_id,\n a.entry_id AS billed_entry,\n b.entry_id AS unbilled_entry\nFROM legal_services.time_entries a\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 legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "List each customer along with another customer living at the same address."
},
{
"role": "assistant",
"content": "SELECT a.customer_id AS customer_id_a, a.first_name || ' ' || a.last_name AS full_name_a, b.customer_id AS customer_id_b, b.first_name || ' ' || b.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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"role": "user",
"content": "Show me the top 5 addresses with the highest balances, along with their public keys."
},
{
"role": "assistant",
"content": "SELECT address_id, public_key, balance FROM blockchain.addresses ORDER BY balance DESC LIMIT 5;"
},
{
"role": "user",
"content": "... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.addresses ( address_id.text, public_key.text, balance.numeric )
|
[
{
"role": "user",
"content": "For each user, show their username and the total number of 'sell' orders they've placed, including users who haven't placed any."
},
{
"role": "assistant",
"content": "SELECT u.username,\n COUNT(o.order_id) FILTER (WHERE o.order_type = 'sell') AS sell_order_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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "List all patients who have received a prescription with the route 'Topical', showing their ID, first name, and last name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT\n p.patient_id,\n p.first_name,\n p.last_name\nFROM\n healthcare.patients p\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Show a list of all trips along with the first and last names of all passengers who have booked on those trips. Each result should have the trip_id, passenger first name and last name."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, p.first_name, p.last_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti... |
[
{
"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 SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "List the service category, the service name with the shortest average processing time in that category, and its average processing time."
},
{
"role": "assistant",
"content": "SELECT m.category, s.service_name, s.average_processing_time_days\nFROM (\n SELECT catego... | You are an SQL statement expert. Given the table 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 text, agency_id text, service_name text, description text, category text, eli... |
[
{
"role": "user",
"content": "Show me the number of players who registered each year. List the registration year and the count."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM registration_date) AS registration_year, COUNT(*) AS player_count FROM gaming_technology.players GROUP B... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"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 SQL statement expert. Given the table 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 the first name, last name, and date of birth for all citizens born before January 1, 1995."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, date_of_birth FROM government_services.citizens WHERE date_of_birth < '1995-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Can you provide the total number of maintenance records for a specific train with train_id 'train_789'?"
},
{
"role": "assistant",
"content": "MATCH (t:Train {train_id: 'train_789'})<-[:PERFORMED_ON]-(mr:MaintenanceRecord)\nRETURN COUNT(mr) AS total_maintenance_reco... | 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: :Platform
// Properties:
// platform_id: String (Constraint: UNIQUE)
// platfo... |
[
{
"role": "user",
"content": "Show me all male patients who have received more than one prescription, including their full name, date of birth, and the total number of prescriptions."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, p.date_of_birth, COUNT(pr.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List the document ID, file name, document type, and uploaded timestamp for all documents uploaded by 'Alice Johnson' between '2023-01-01' and '2023-12-31'."
},
{
"role": "assistant",
"content": "SELECT document_id, file_name, document_type, uploaded_at FROM insuranc... | You are an SQL statement expert. Given the table 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, claim_id.text, document_type.text, file_name.text, file_path.text, file_s... |
[
{
"role": "user",
"content": "List all pairs of transactions where the recipient of the first transaction became the sender in the second, showing the first transaction_id, the second transaction_id, the shared address, and the timestamps of both transactions."
},
{
"role": "assistant",
"content... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "Show notifications about comments, listing the notification ID, the creation time, and the content of the related comment."
},
{
"role": "assistant",
"content": "SELECT n.notification_id, n.created_at, c.content AS comment_content FROM social_media.notifications n J... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t... |
[
{
"role": "user",
"content": "List the first names, last names, and work emails of employees who have the same job title as their direct manager."
},
{
"role": "assistant",
"content": "SELECT e1.first_name, e1.last_name, e1.work_email\nFROM government_services.employees e1\nJOIN government_servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, depa... |
[
{
"role": "user",
"content": "List all document IDs and their corresponding location names for documents that are associated with applications assigned to a service location in the city of 'Los Angeles'."
},
{
"role": "assistant",
"content": "SELECT d.document_id, sl.location_name\nFROM governme... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "Find all contracts whose address appears in token transfers and show the contract_id, address, and the total number of transfers involving that address (either as sender or recipient)."
},
{
"role": "assistant",
"content": "SELECT\n c.contract_id,\n c.address,\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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "How many posts are marked with 'unlisted' visibility?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.posts WHERE visibility = 'unlisted';"
}
] | You are an SQL statement expert. Given the table 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, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "List claims that were reported in 2024 with an estimated loss between 5000 and 15000. Include the claim ID, reported date, estimated loss, and status."
},
{
"role": "assistant",
"content": "SELECT\n claim_id,\n reported_date,\n estimated_loss,\n status\nFROM\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 insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "Find vehicles whose capacity is greater than the average capacity for their type. Show the vehicle_id, type, and capacity."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.type, v.capacity FROM transportation.vehicles v JOIN (SELECT type, AVG(capacity) ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Show me all bookings for trips going to locations in 'California' state, including the passenger's first name, last name, booking_id, and the city of the destination."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, b.booking_id, l.city AS de... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations (
location_id character varying(64) NOT NULL, -- unique identifier for the location
n... |
[
{
"role": "user",
"content": "List the first name, last name, and relationship for all beneficiaries whose percentage share is between 10 and 50, inclusive."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, relationship FROM insurance.policy_beneficiaries WHERE percentage_shar... | You are an SQL statement expert. Given the table 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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "List each conversation_id and the number of unread messages (where read_at is null)."
},
{
"role": "assistant",
"content": "SELECT m.conversation_id, COUNT(*) AS unread_messages FROM social_media.messages m WHERE m.read_at IS NULL GROUP BY m.conversation_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 character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Which items have been acquired by players in the last 7 days? Show the item name, rarity, and total quantity acquired across all players."
},
{
"role": "assistant",
"content": "SELECT i.item_name, i.rarity, SUM(pi.quantity) AS total_acquired\nFROM 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.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... |
[
{
"role": "user",
"content": "Find all pairs of distinct routes that share the same origin location ID. List the route IDs and route numbers for both routes in each pair, along with the shared origin location ID."
},
{
"role": "assistant",
"content": "SELECT r1.route_id AS route1_id, r1.route_nu... | You are an SQL statement expert. Given the table 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": "What is the total net_flow and average realized_ratio for tokens on the Polygon chain?"
},
{
"role": "assistant",
"content": "SELECT SUM(net_flow) AS total_net_flow, AVG(realized_ratio) AS avg_realized_ratio\nFROM smart_money_token_performance\nWHERE chain = 'Polygo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,... |
[
{
"role": "user",
"content": "Generate a report that lists each manager’s full name and the count of direct reports they have."
},
{
"role": "assistant",
"content": "SELECT m.employee_id,\n m.first_name || ' ' || m.last_name AS manager_name,\n COUNT(e.employee_id) AS direct_repo... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the trans... |
[
{
"role": "user",
"content": "For each group chat, retrieve the conversation_id, group_name, and the timestamp of the latest like on any comment."
},
{
"role": "assistant",
"content": "SELECT c.conversation_id,\n c.group_name,\n MAX(l.created_at) AS latest_comment_like\nFROM social_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.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
CREATE TABLE soc... |
[
{
"role": "user",
"content": "List each token_id and the number of transfers recorded for that token."
},
{
"role": "assistant",
"content": "SELECT token_id, COUNT(*) AS transfer_count\nFROM web3.token_transfers\nGROUP BY token_id;"
},
{
"role": "user",
"content": "Actually, only inc... | You are an SQL statement expert. Given the table 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 drivers whose licenses are set to expire within the next 60 days, along with their full name, license number, and contact number."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, license_number, contact_number\nFROM transporta... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "Show me all users who have wallets but have never placed any orders, along with their wallet addresses and creation dates."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, w.address, w.created_at AS wallet_creation_date FROM trading_platform.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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "Which fundraising project in 2022 had the highest valuation, and which token (by symbol) from smart_money_token_performance matches the project name? Please display project_name, valuation, rounds_name, and the matched token_symbol."
},
{
"role": "assistant",
"conte... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Retrieve the top 5 most expensive active services along with their agency names."
},
{
"role": "assistant",
"content": "SELECT s.service_name, a.agency_name, s.standard_fee FROM government_services.services s JOIN government_services.agencies a ON s.agency_id = a.ag... | You are an SQL statement expert. Given the table 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": "Show the first and last names of citizens along with the total amount of all payments associated with them."
},
{
"role": "assistant",
"content": "SELECT T1.first_name , T1.last_name , SUM(T2.amount) FROM government_services.citizens AS T1 JOIN 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.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "Can you list all achievement names and their point values, along with the name of the developer for each achievement's game?"
},
{
"role": "assistant",
"content": "SELECT a.name AS achievement_name, a.points, d.name AS developer_name\nFROM gaming_technology.achievem... | You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU... |
[
{
"role": "user",
"content": "List all services, showing the service name, category, and the name of the property where it is offered."
},
{
"role": "assistant",
"content": "SELECT T1.service_name, T1.category, T2.property_name FROM hospitality_technology.services AS T1 JOIN hospitality_technolo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with their room types and base rates, ordered by star rating in descending order."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, p.star_rating, rt.type_name, rt.b... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city.... |
[
{
"role": "user",
"content": "Which servers are currently offline, and how many players could they host if all were full? Please show the server name, region, and max_players."
},
{
"role": "assistant",
"content": "SELECT server_name, region, max_players\nFROM gaming_technology.servers\nWHERE st... | You are an SQL statement expert. Given the table 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": "Show the appointment ID, scheduled start time, and the full name of the citizen for all appointments related to services with a standard fee greater than 150."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.scheduled_start_time, c.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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show me the hashtag IDs and their names."
},
{
"role": "assistant",
"content": "SELECT hashtag_id, tag_name FROM social_media.hashtags;"
},
{
"role": "user",
"content": "I also want to see when each hashtag was created."
},
{
"role": "assistant",... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre... |
[
{
"role": "user",
"content": "List all documents with their document_name, document_type, the name of the associated case, and the first and last name of the client who owns the case."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.document_name, d.document_type, c.case_name, cl.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 legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "Find pairs of distinct locations in the same city that have different types. Include location IDs, names, city, and type for both locations."
},
{
"role": "assistant",
"content": "SELECT l1.location_id AS location1_id, l1.name AS location1_name, l1.city, l1.type 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 transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, ... |
[
{
"role": "user",
"content": "Show me the total billable hours and total billable amount for each lawyer for entries worked in 2024."
},
{
"role": "assistant",
"content": "SELECT lawyer_id,\n SUM(hours_spent) AS total_hours,\n SUM(hours_spent * billing_rate) AS total_amount\nFROM leg... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "Which invoices were issued in March 2024, and what are their invoice numbers, total amounts, and due dates?"
},
{
"role": "assistant",
"content": "SELECT invoice_number, total_amount, due_date FROM legal_services.invoices WHERE issue_date >= '2024-03-01' AND issue_d... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date... |
[
{
"role": "user",
"content": "Find pairs of events within the same transaction that have the same event name but were emitted by different contracts. List the transaction ID, the shared event name, the IDs of both events, and the IDs of their respective contracts."
},
{
"role": "assistant",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Find acquisition event pairs for each player where they acquired two distinct items. Show player_id, the first inventory_id as inv1, the second inventory_id as inv2, and their corresponding item_ids."
},
{
"role": "assistant",
"content": "SELECT p1.player_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquire... |
[
{
"role": "user",
"content": "Find all chronic diagnoses made by Cardiology doctors in the last year, including patient ID, diagnosis description, and doctor's full name."
},
{
"role": "assistant",
"content": "SELECT di.patient_id, di.description, d.first_name || ' ' || d.last_name AS doctor_nam... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "List all ERC20 tokens where the total supply is less than 100,000, including their names and symbols."
},
{
"role": "assistant",
"content": "SELECT name, symbol, total_supply FROM token_metas WHERE is_erc20 = 1 AND CAST(total_supply AS decimal) < 100000;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "Find all notifications where the message subject contains the word 'Alert'."
},
{
"role": "assistant",
"content": "SELECT notification_id, citizen_id, application_id, message_subject, message_body, channel, sent_at, status, related_entity_type, related_entity_id 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 government_services.notifications ( notification_id text, citizen_id text, application_id text, message_subject text, m... |
[
{
"role": "user",
"content": "List all doctors who have not written any prescriptions. Return doctor_id, first_name, and last_name."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name FROM healthcare.doctors d LEFT JOIN healthcare.prescriptions p ON d.doctor_id =... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show me all guests from California who are loyalty members, along with their email and phone number, ordered by last name."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, phone_number FROM hospitality_technology.guests WHERE state_provinc... | You are an SQL statement expert. Given the table 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 booking with its previous booking time for the same passenger."
},
{
"role": "assistant",
"content": "SELECT b.booking_id,\n b.passenger_id,\n b.booking_time,\n LAG(b.booking_time) OVER (PARTITION BY b.passenger_id ORDER BY b.booking_time... | You are an SQL statement expert. Given the table 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 text, passenger_id text, trip_id text, seat_number text, booking_time timestamp, s... |
[
{
"role": "user",
"content": "Show me all time entries from the last 90 days, including the entry description, hours spent, the name of the case, and the name of the client."
},
{
"role": "assistant",
"content": "SELECT T1.description, T1.hours_spent, T2.case_name, T3.first_name, T3.last_name FR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique identifier for the time entry
... |
[
{
"role": "user",
"content": "I need to identify pairs of verified documents submitted by the same citizen. For each pair, display the citizen_id, the earlier document_id with its verification timestamp, and the later document_id with its verification timestamp."
},
{
"role": "assistant",
"conte... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "List the first and last names, email, and loyalty program ID of all passengers who joined after January 1, 2024."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, loyalty_program_id\nFROM transportation.passengers\nWHERE created_at > '2024-... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro... |
[
{
"role": "user",
"content": "Show me all guests from California who are loyalty members and have provided both email and phone number, sorted by their last name in alphabetical order."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email, phone_number FROM hospita... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"role": "user",
"content": "List the top 5 oldest verified citizens. Show each citizen's full name and date of birth."
},
{
"role": "assistant",
"content": "SELECT\n first_name || ' ' || last_name AS full_name,\n date_of_birth\nFROM government_services.citizens\nWHERE is_verified = TRUE\nORD... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Find all patients who have been prescribed medications (mentioned in appointment notes) along with their doctors' names and the medication details mentioned."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, d.first_name AS docto... | You are an SQL statement expert. Given the table 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": "Can you list all the policy numbers and their group_numbers for policies that will expire within the next 90 days from today?"
},
{
"role": "assistant",
"content": "SELECT policy_number, group_number FROM healthcare.patient_insurance WHERE expiration_date BETWEEN 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 healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "Find all smart contracts where the code length is greater than 1000 characters."
},
{
"role": "assistant",
"content": "SELECT contract_id, creator_address, LENGTH(code) AS code_length\nFROM blockchain.smart_contracts\nWHERE LENGTH(code) > 1000;"
},
{
"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 blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
|
[
{
"role": "user",
"content": "Find players who acquired two different items within the same minute. List the player ID, and the inventory IDs of the two acquisitions."
},
{
"role": "assistant",
"content": "SELECT t1.player_id, t1.inventory_id AS inventory_id_1, t2.inventory_id AS inventory_id_2 ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid, player_id uuid, item_id uuid, quantity integer, acquired_at tim... |
[
{
"role": "user",
"content": "Retrieve all pairs of nodes that share the same port and were last seen on the same day. Include node_id, ip_address, and last_seen of both nodes."
},
{
"role": "assistant",
"content": "SELECT n1.node_id AS node_id1, n1.ip_address AS ip1, n1.last_seen AS last_seen1,... | You are an SQL statement expert. Given the table 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.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
|
[
{
"role": "user",
"content": "Show me all active policies with coverage limits above $1,000,000, along with the customer names and agent names."
},
{
"role": "assistant",
"content": "SELECT p.policy_id, p.policy_number, p.customer_id, p.agent_id, p.coverage_limit, p.start_date, p.end_date FROM 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 insurance.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "Find employees who are managers and list the number of employees they directly manage. Show the manager's full name and the count of their direct reports."
},
{
"role": "assistant",
"content": "SELECT m.first_name || ' ' || m.last_name AS manager_full_name, COUNT(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 government_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "List the names of service locations and the names of the agencies they belong to, specifically for locations situated in the state of 'Texas' that are marked as accessible."
},
{
"role": "assistant",
"content": "SELECT t1.location_name, t2.agency_name FROM governmen... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Find all citizens who have both uploaded at least one document and made at least one payment. Show their citizen ID, full name, and contact email."
},
{
"role": "assistant",
"content": "SELECT c.citizen_id, c.first_name || ' ' || c.last_name AS full_name, c.contact_... | You are an SQL statement expert. Given the table 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": "Display the name and type of each location, as well as the earliest and latest maintenance service_date for vehicles assigned to that location (assuming vehicle_id matches location_id)."
},
{
"role": "assistant",
"content": "SELECT l.name, l.type,\n MIN(m.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 transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro... |
[
{
"role": "user",
"content": "Show me all trades (trade_id, security_id, total_amount, trade_timestamp) along with the account type and balance for each trade, sorted by trade_timestamp in descending order."
},
{
"role": "assistant",
"content": "SELECT t.trade_id, t.security_id, t.total_amount, ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "List the file name and file size for all claim documents uploaded by agents whose license state is 'CA' and status is 'Active'."
},
{
"role": "assistant",
"content": "SELECT T1.file_name, T1.file_size_bytes FROM insurance.claim_documents AS T1 JOIN insurance.agents ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "List the symbol, name, and total supply for all ERC20 tokens."
},
{
"role": "assistant",
"content": "SELECT symbol, name, total_supply FROM token_metas WHERE is_erc20 = 1;"
},
{
"role": "user",
"content": "Include the decimals and tell me if each token 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "Can you help me get a list of inspections performed on a specific aircraft build, including the employee who performed them and the inspected component details?"
},
{
"role": "assistant",
"content": "MATCH (ab:AircraftBuild {build_id: 'specific_build_id'})-[:UNDERWE... | 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 ':Component'. Properties: { component_id: String (Constraint: UNIQUE), part_number: St... |
[
{
"role": "user",
"content": "List all guests who have placed service orders for services in the 'Transportation' department, along with their full names and the service names."
},
{
"role": "assistant",
"content": "SELECT g.guest_id, g.first_name, g.last_name, s.service_name\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.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"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 SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id text, application_id text, citizen_id text, document_type text, file_refere... |
[
{
"role": "user",
"content": "Provide each pair of plans that share the same plan_type but are offered by different providers."
},
{
"role": "assistant",
"content": "SELECT p1.plan_type,\n p1.plan_id AS plan1_id,\n p1.plan_name AS plan1_name,\n p1.insurance_provider AS provider... | You are an SQL statement expert. Given the table 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.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_provider text, plan_type text, contact... |
[
{
"role": "user",
"content": "What is the total count of medical records created in the year 2023 where the assessment field is not empty?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM healthcare.medical_records mr WHERE (mr.assessment IS NOT NULL AND mr.assessment != '') AND EXTRA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "What is the history of incidents or accidents that occurred on platform 5 at station GHI?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about the history of incidents or accidents on platform 5 at station GHI. My data is limited t... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.p... |
[
{
"role": "user",
"content": "Show me all PDF claim documents that were uploaded after March 1st, 2024, and the usernames of those who uploaded them, along with the related claim ID."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_name, uploaded_by FROM insurance.claim_... | You are an SQL statement expert. Given the table 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": "What is the total USD value held across all wallets for the ERC20 token with symbol 'DAI'?"
},
{
"role": "assistant",
"content": "SELECT SUM((eb.amount::numeric / POWER(10, tm.decimals)) * tpl.price) AS total_usd\nFROM erc20_balances eb\nJOIN token_metas tm ON eb.co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "Find medical records where the assessment mentions the generic name of any medication. Show the record ID, record date, patient ID, and the generic name mentioned."
},
{
"role": "assistant",
"content": "SELECT T1.record_id, T1.record_date, T1.patient_id, T2.generic_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d... |
[
{
"role": "user",
"content": "Show me all maintenance logs for vehicles of make 'Toyota' performed after January 1, 2024. Include the log ID, vehicle ID, service date, and service type."
},
{
"role": "assistant",
"content": "SELECT ml.log_id, ml.vehicle_id, ml.service_date, ml.service_type\nFROM... | You are an SQL statement expert. Given the table 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": "How many developers are there in each country?"
},
{
"role": "assistant",
"content": "SELECT\n country,\n COUNT(developer_id) AS developer_count\nFROM\n gaming_technology.developers\nWHERE country IS NOT NULL\nGROUP BY\n country;"
},
{
"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 gaming_technology.developers (
developer_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the d... |
[
{
"role": "user",
"content": "List all insurance plans with their plan ID, plan name, and the total number of prescriptions made for each plan (via any patient's insurance policy for that plan)."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id, ip.plan_name, COUNT(pres.prescription_id) 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 healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,... |
[
{
"role": "user",
"content": "Retrieve the distinct generic_name values and the number of medications for each generic_name, sorted by the count descending."
},
{
"role": "assistant",
"content": "SELECT generic_name,\n COUNT(*) AS medication_count\nFROM healthcare.medications\nGROUP BY gen... | You are an SQL statement expert. Given the table 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 text, medication_name text, generic_name text, manufacturer text, ndc_code text,... |
[
{
"role": "user",
"content": "Show the top 5 largest documents by file size, including document_id, claim_id, file_name, and file_size_bytes."
},
{
"role": "assistant",
"content": "SELECT document_id,\n claim_id,\n file_name,\n file_size_bytes\nFROM insurance.claim_documents\nO... | You are an SQL statement expert. Given the table 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 each player with their player_id, username, the number of distinct in-game items they own, and the total quantity of those items."
},
{
"role": "assistant",
"content": "```sql\nSELECT\n p.player_id,\n p.username,\n COUNT(DISTINCT i.item_id) AS distinct_item_... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "List all properties that have at least one room with 'Ocean View' in its features, showing the property name and the total count of such rooms."
},
{
"role": "assistant",
"content": "SELECT T1.property_name, COUNT(T2.room_id) FROM hospitality_technology.properties 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 character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show projects that raised funds in 2023 along with their token symbols and current prices from token_basic_info."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name,\n pfr.rounds_name,\n pfr.investment_value,\n tbi.token_symbol,\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 project_fundraising_record ( id text, project_id text, project_name text, rounds_name text, investment_value numeric, i... |
[
{
"role": "user",
"content": "Show me the name and founding date of every law firm."
},
{
"role": "assistant",
"content": "SELECT firm_name, founded_date\nFROM law_firms;"
},
{
"role": "user",
"content": "Also include the firm's phone number."
},
{
"role": "assistant",
"c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.