conversations listlengths 2 8 | system stringlengths 276 8.23k |
|---|---|
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 3.5, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.city, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p 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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Could you produce a summary report listing each security's ticker_symbol, exchange, average close_price, and average volume based on market_data?"
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, s.exchange, AVG(m.close_price) AS avg_close_price, AVG(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 financial_services.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N... |
[
{
"role": "user",
"content": "Show me the document ID, document type, and uploaded timestamp for all claim documents."
},
{
"role": "assistant",
"content": "SELECT document_id, document_type, uploaded_at FROM insurance.claim_documents;"
},
{
"role": "user",
"content": "Now, include 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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "Show me the top 3 smart money addresses by profit across all chains, along with their most profitable token and chain information."
},
{
"role": "assistant",
"content": "SELECT address, profit, most_profit_token, chain\nFROM smart_money_profit\nORDER BY profit DESC\... | You are an SQL statement expert. Given the table 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 pairs of citizens who share the same email domain."
},
{
"role": "assistant",
"content": "SELECT c1.first_name AS first1,\n c1.last_name AS last1,\n c2.first_name AS first2,\n c2.last_name AS last2,\n SPLIT_PART(c1.contact_email, '@', 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "For each mechanic, show the total number of maintenance logs they have performed and the average cost of these logs."
},
{
"role": "assistant",
"content": "SELECT mechanic_name, COUNT(*) AS log_count, AVG(cost) AS average_cost FROM transportation.maintenance_logs GR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Show photo claim documents uploaded in the last 7 days, including document_id, claim_id, file_name, uploaded_at, and the customer's full name."
},
{
"role": "assistant",
"content": "SELECT cd.document_id,\n cd.claim_id,\n cd.file_name,\n cd.uploade... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "Can you narrow this down to only show cases where the case type is 'Criminal'?"
},
{
"role": "assistant",
"content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Crimin... | You are an SQL statement expert. Given the table 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 wallet, find the next wallet created by the same user. Return the user_id, the earlier wallet_id, the later wallet_id, and the time difference in minutes between their creation times."
},
{
"role": "assistant",
"content": "SELECT user_id,\n wallet_id ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "What is the ticket price for a journey on train number T4321?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to information about ticket prices for specific trains. The data I have is limited to train details such as model, manufacturer, c... | 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.t... |
[
{
"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": "Find pairs of cases that belong to the same client, listing the case number, case name, and the shared client ID for each pair."
},
{
"role": "assistant",
"content": "SELECT c1.case_number AS case_number_1, c1.case_name AS case_name_1, c2.case_number AS case_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 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": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, floor_price FROM nft_collections WHERE blockchain = 'ethereum' ORDER BY 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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "Could you list each game title along with its developer's name and the total number of servers hosting it?"
},
{
"role": "assistant",
"content": "SELECT g.title, d.name AS developer_name, COUNT(s.server_id) AS server_count\nFROM gaming_technology.games g\nLEFT JOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date... |
[
{
"role": "user",
"content": "Which games have achievements where the points value is exactly 0? List the game title and the achievement name."
},
{
"role": "assistant",
"content": "SELECT g.title AS game_title, a.name AS achievement_name\nFROM gaming_technology.achievements a\nJOIN gaming_techn... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "For each group chat, list its ID, name, creation time, and the creation time of the next group chat created after it, ordered by creation time."
},
{
"role": "assistant",
"content": "SELECT conversation_id, group_name, created_at, LEAD(created_at) OVER (ORDER BY cre... | You are an SQL statement expert. Given the table 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.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR... |
[
{
"role": "user",
"content": "Can you list all SUI coins with 'active' status and their owner addresses and balances?"
},
{
"role": "assistant",
"content": "SELECT object_id, coin_type, owner, balance\nFROM sui_coins\nWHERE status = 'active';"
},
{
"role": "user",
"content": "Add the... | You are an SQL statement expert. Given the table 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": "For each guest, list reservation_id, guest_id, check_in_date, and the next reservation_id and its check_in_date."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id,\n r1.guest_id,\n r1.check_in_date,\n r2.reservation_id AS next_reserva... | You are an SQL statement expert. Given the table 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.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ... |
[
{
"role": "user",
"content": "How many lawyers who are partners were hired in each year? Show the hire year and the count."
},
{
"role": "assistant",
"content": "SELECT strftime('%Y', hire_date) AS hire_year , count(lawyer_id) FROM legal_services.lawyers WHERE is_partner = true GROUP BY hire_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "List the total amount currently held and the number of unique wallets for each Bitcoin token tick."
},
{
"role": "assistant",
"content": "SELECT tb.tick, SUM(tb.amount) AS total_amount, COUNT(DISTINCT tb.wallet_address) AS unique_wallets\nFROM token_balances_bitcoin... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "List all pairs of tokens (show token_id for both) that share the same contract address, excluding pairs where the token_id is the same."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id1, t2.token_id AS token_id2, t1.contract_address FROM web3.to... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, contract_address character varying(128) NOT NULL, token_name cha... |
[
{
"role": "user",
"content": "Calculate the average number of days between when an incident occurred and when the claim was reported, but only for claims that were settled in the year 2023."
},
{
"role": "assistant",
"content": "SELECT\n AVG(EXTRACT(EPOCH FROM (reported_date - incident_date)) /... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "List usernames and the length of their 'bio' field for users whose 'is_verified' status is true."
},
{
"role": "assistant",
"content": "SELECT username, LENGTH(bio) AS bio_length FROM social_media.users WHERE is_verified IS TRUE;"
}
] | You are an SQL statement expert. Given the table 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 all insurance plans that cover more than 10 patients as their primary insurance, along with the provider name and contact information."
},
{
"role": "assistant",
"content": "SELECT ip.plan_name, ip.insurance_provider, ip.contact_phone, ip.website, COUNT(pi.p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "What is the fuel efficiency of the train car with car_id 'TC456'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to information about the fuel efficiency of specific train cars. The data available in the train_cars table only includes deta... | 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.t... |
[
{
"role": "user",
"content": "Can you provide the number of doctors grouped by their medical specialty?"
},
{
"role": "assistant",
"content": "SELECT specialty, COUNT(*) AS doctor_count\nFROM healthcare.doctors\nGROUP BY specialty;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors (
doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor
first_name ... |
[
{
"role": "user",
"content": "Count the number of posts that have a media URL but no textual content."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.posts AS T1 WHERE T1.media_url IS NOT NULL AND (T1.content IS NULL OR T1.content = '');"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List all active staff members who are managers, along with their hire dates and email addresses."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true AND position LIKE '%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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "List all services with an average processing time greater than the overall average processing time for all services. Show the service name, average processing time, and the overall average processing time."
},
{
"role": "assistant",
"content": "SELECT service_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.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "List all NFT collections where the floor price is greater than 0.5 ETH, including their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address FROM nft_collections WHERE CAST(floor_price AS decimal) > 0.5 AND floor_price_s... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"role": "user",
"content": "Show me all events emitted by contracts where the event name contains 'Approval', along with the contract ID and transaction ID, sorted by emitted timestamp in descending order."
},
{
"role": "assistant",
"content": "SELECT event_id, contract_id, event_name, transac... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Get the number of direct reports for each manager, showing manager_id and report_count."
},
{
"role": "assistant",
"content": "SELECT manager_id,\n COUNT(*) AS report_count\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL\nGROUP BY manager_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.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir... |
[
{
"role": "user",
"content": "Show me all vehicles that had maintenance in the past month, including their make, model, maintenance service_date, and depot name."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id,\n v.make,\n v.model,\n m.service_date,\n l.name AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "List the content and creation time of all posts made in the last 7 days."
},
{
"role": "assistant",
"content": "SELECT content, created_at FROM social_media.posts WHERE created_at >= NOW() - INTERVAL '7 day';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "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": "Show me all wallet addresses that hold more than 3 different NFTs from any ERC1155 contract. For each wallet, list the contract address and the count of distinct token_ids."
},
{
"role": "assistant",
"content": "SELECT contract_address, wallet_address, COUNT(DISTINC... | You are an SQL statement expert. Given the table 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": "What is the average ROI for smart money addresses on the Ethereum chain with a realized profit ratio above 50%?"
},
{
"role": "assistant",
"content": "SELECT AVG(roi) as average_roi\nFROM smart_money_token_performance\nWHERE chain = 'Ethereum'\nAND realized_ratio > ... | You are an SQL statement expert. Given the table 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": "How many insurance policies does each patient have? Return patient_id and policy_count."
},
{
"role": "assistant",
"content": "SELECT patient_id,\n COUNT(*) AS policy_count\nFROM healthcare.patient_insurance\nGROUP BY patient_id;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "List the top 5 tokens by 24 hour trading volume on DEX pools."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, volume_24h \nFROM token_dexpool_info \nORDER BY volume_24h DESC LIMIT 5;"
},
{
"role": "user",
"content": "Show only the... | You are an SQL statement expert. Given the table 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 ch... |
[
{
"role": "user",
"content": "List all beneficiaries associated with policy ID 'POL12345', including their full name and relationship."
},
{
"role": "assistant",
"content": "SELECT beneficiary_id, first_name, last_name, relationship FROM insurance.policy_beneficiaries WHERE policy_id = 'POL12345... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, policy_id text, customer_id text, first_name text, la... |
[
{
"role": "user",
"content": "Show me the top 5 users who have interacted with DApps, along with the count of distinct DApps they interacted with and their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT w.user_id, COUNT(DISTINCT d.dapp_id) AS dapp_count, w.address FROM trading_p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Get the property name, room type name, base rate, and star rating for all room types with a base_rate above 200 in properties located in the USA, sorted by base_rate in descending order."
},
{
"role": "assistant",
"content": "SELECT p.property_name, rt.type_name, rt... | You are an SQL statement expert. Given the table 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 me all loans where the principal amount is between 50,000 and 200,000. Include loan_id, account_id, loan_type, and principal_amount."
},
{
"role": "assistant",
"content": "SELECT loan_id, account_id, loan_type, principal_amount FROM financial_services.loans WHE... | You are an SQL statement expert. Given the table 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": "Find all pairs of transactions where both transactions have the same nonce and from_address, but different transaction_id. Show both transaction IDs, the shared from_address, shared nonce, and their block numbers."
},
{
"role": "assistant",
"content": "SELECT t1.tra... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"role": "user",
"content": "Show me all insurance plans where the website includes 'secure'."
},
{
"role": "assistant",
"content": "SELECT * FROM healthcare.insurance_plans WHERE website ILIKE '%secure%';"
}
] | You are an SQL statement expert. Given the table 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": "I want to find all appointment pairs where two appointments are scheduled for the same client at overlapping times. Provide the appointment_id from both overlapping appointments."
},
{
"role": "assistant",
"content": "SELECT a1.appointment_id AS appointment_id_1, a2... | You are an SQL statement expert. Given the table 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.appointments ( appointment_id text PRIMARY KEY, client_id text, lawyer_id text, case_id text, start_time... |
[
{
"role": "user",
"content": "Retrieve all beneficiaries with their policy numbers, including beneficiary first and last name, relationship, and the policy end date."
},
{
"role": "assistant",
"content": "SELECT pb.beneficiary_id, pb.first_name, pb.last_name, pb.relationship, p.policy_number, p.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"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": "List the citizen_id, first_name, last_name, and registration_date for all citizens who registered during March 2024."
},
{
"role": "assistant",
"content": "SELECT citizen_id, first_name, last_name, registration_date\nFROM government_services.citizens\nWHERE registra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "List all individual token holdings by CEX addresses on the 'Arbitrum' chain with a USD value greater than $100,000. Show the exchange, token symbol, and USD value."
},
{
"role": "assistant",
"content": "SELECT exchange, token_symbol, usd_value FROM cex_token_balance... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.text, chain.text, price.numeric, pri... |
[
{
"role": "user",
"content": "Find all NFTs with a rarity rank less than 100 and show their name and the name of their collection."
},
{
"role": "assistant",
"content": "SELECT nm.name AS nft_name, nc.name AS collection_name FROM nft_metadata nm JOIN nft_collections nc ON nm.contract_address = n... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch... |
[
{
"role": "user",
"content": "Show the latest version number of each document_name for every case."
},
{
"role": "assistant",
"content": "SELECT case_id,\n document_name,\n MAX(version) AS latest_version\nFROM legal_services.documents\nGROUP BY case_id, document_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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "Show me all reservations made by guests from 'California' with their full name and the property name where they stayed. Include the reservation ID and check-in date."
},
{
"role": "assistant",
"content": "SELECT t1.reservation_id, t2.first_name, t2.last_name, t3.pro... | You are an SQL statement expert. Given the table 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": "What are the fuel consumption rates per hour for the Boeing 747-8 model?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "List document names and versions for documents that share the same case_id, showing each pair of versions."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version ... | You are an SQL statement expert. Given the table 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.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "I need to list the top 5 ERC20 tokens by total supply, including symbol, contract_address, and name."
},
{
"role": "assistant",
"content": "SELECT tm.contract_address, tm.symbol, tm.name, CAST(tm.total_supply AS DECIMAL) AS total_supply\nFROM token_metas tm\nWHERE 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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List the name of NFTs and their contract name, along with the symbol and total supply from the token information table, for NFTs on the 'ethereum' blockchain."
},
{
"role": "assistant",
"content": "SELECT T1.name, T1.contract_name, T2.symbol, T2.total_supply FROM nf... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t... |
[
{
"role": "user",
"content": "Show me the top 5 transactions with the highest gas prices, including the from_address, to_address, and block_number, sorted by gas_price in descending order."
},
{
"role": "assistant",
"content": "SELECT from_address, to_address, block_number, gas_price FROM web3.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 web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price... |
[
{
"role": "user",
"content": "Get the number of agents grouped by status. Return status and agent_count."
},
{
"role": "assistant",
"content": "SELECT status,\n COUNT(*) AS agent_count\n FROM insurance.agents\n GROUP BY status;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens with decimals equal to 18."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, total_supply FROM token_metas WHERE ... | You are an SQL statement expert. Given the table 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": "Count how many posts have media attachments."
},
{
"role": "assistant",
"content": "SELECT count(*) FROM social_media.posts WHERE media_url IS NOT NULL"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and belong to the 'Technology' sector."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, security_name\nFROM financial_services.securities\... | You are an SQL statement expert. Given the table 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": "What is the detailed repair history of the equipment used by the staff with staff_id 'STAFF123' during maintenance tasks?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the detailed repair history of equipment used by staff memb... | 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.m... |
[
{
"role": "user",
"content": "Which agents were hired in 2023 and have a commission rate over 0.07? Return their agent_id, full name, agency name, and hire date."
},
{
"role": "assistant",
"content": "SELECT agent_id, first_name, last_name, agency_name, hire_date\nFROM insurance.agents\nWHERE EX... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"role": "user",
"content": "List all pairs of beneficiaries on the same policy where one is a 'Parent' and the other is a 'Child'. Return policy_id, parent_id, and child_id."
},
{
"role": "assistant",
"content": "SELECT pb1.policy_id,\n pb1.beneficiary_id AS parent_id,\n pb2.benefi... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, policy_id character varying(64) NOT NUL... |
[
{
"role": "user",
"content": "List lawyers who have any unbilled time entries. Show their first name, last name, and the count of their unbilled entries."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, COUNT(T2.entry_id) FROM lawyers AS T1 JOIN time_entries AS T2 ON T1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "For each Bitcoin token tick, show me the creator address from the token_info_bitcoin table and the number of unique wallets currently holding that token."
},
{
"role": "assistant",
"content": "SELECT ti.tick, ti.creator, COUNT(DISTINCT tb.wallet_address) AS unique_w... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "Show me the average star rating for each property type in the USA."
},
{
"role": "assistant",
"content": "SELECT property_type, AVG(star_rating) as avg_rating FROM hospitality_technology.properties WHERE country_code = 'US' GROUP BY property_type;"
},
{
"rol... | You are an SQL statement expert. Given the table 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 each employee who has verified more than one document, list their employee ID, the first document they verified, and the next document they verified, along with both verification timestamps."
},
{
"role": "assistant",
"content": "SELECT\n d1.verified_by_employe... | You are an SQL statement expert. Given the table 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 each appointment with appointment ID, appointment time, doctor's last name, and the patient's primary insurance plan name."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id,\n a.appointment_time,\n d.last_name AS doctor_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 PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "How many time entries does each client have? Provide the client's first and last name along with the count, sorted by count descending."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(te.entry_id) AS entry_count FROM legal_services.cli... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "Can you give me all locations in Los Angeles?"
},
{
"role": "assistant",
"content": "SELECT location_id, name, type, address_line1, city, state_province, postal_code, country, latitude, longitude, timezone\nFROM transportation.locations\nWHERE city = 'Los Angeles';"... | You are an SQL statement expert. Given the table 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 the top 5 users who have created the most wallets, along with their email addresses and the creation date of their first wallet."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, MIN(w.created_at) AS first_wallet_date, COUNT(w.wallet_id) AS 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 trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Show the name and symbol for all assets in the system."
},
{
"role": "assistant",
"content": "SELECT name, symbol FROM assets;"
},
{
"role": "user",
"content": "Now, include any associated metadata key and value for each asset. If an asset has no metadat... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "List all medical record entries where the treatment_plan mentions a medication name. Return patient_id, record_id, and the matching medication_name."
},
{
"role": "assistant",
"content": "SELECT mr.patient_id,\n mr.record_id,\n m.medication_name\nFROM he... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "List the usernames and user IDs of all users whose bio contains the word 'developer'."
},
{
"role": "assistant",
"content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';"
}
] | You are an SQL statement expert. Given the table 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 all rooms that are on floor 3."
},
{
"role": "assistant",
"content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;"
},
{
"role": "user",
"content": "For these rooms, include the property name and room 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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Find all documents of type 'Correspondence' uploaded in 2023. Show the document name, upload timestamp, and the name of the case it belongs to."
},
{
"role": "assistant",
"content": "SELECT T1.document_name, T1.upload_timestamp, T2.case_name FROM legal_services.docu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Find documents that have the same document_name but are associated with different cases. Show the document name and the two different case IDs."
},
{
"role": "assistant",
"content": "SELECT d1.document_name, d1.case_id AS case_id_1, d2.case_id AS case_id_2 FROM lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "I need the average capacity of vehicles for each fuel_type."
},
{
"role": "assistant",
"content": "SELECT fuel_type,\n AVG(capacity) AS avg_capacity\nFROM transportation.vehicles\nGROUP BY fuel_type;"
},
{
"role": "user",
"content": "Only include 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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "List all reservations, showing the guest's full name (first and last name) and the property name for each."
},
{
"role": "assistant",
"content": "SELECT t2.first_name, t2.last_name, t3.property_name FROM hospitality_technology.reservations AS t1 INNER JOIN hospitali... | You are an SQL statement expert. Given the table 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 agencies that do not have a website URL specified. Return their agency_id, agency_name, and main_phone_number."
},
{
"role": "assistant",
"content": "SELECT agency_id, agency_name, main_phone_number FROM government_services.agencies WHERE website_url IS NUL... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"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": "Which games have at least one achievement worth exactly 75 points, and what are the names and descriptions of those achievements?"
},
{
"role": "assistant",
"content": "SELECT g.title, a.name AS achievement_name, a.description\nFROM gaming_technology.games g\nJOIN g... | You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "Retrieve a list of all patient insurance policies, showing the subscriber name and the name of the insurance provider for the plan."
},
{
"role": "assistant",
"content": "SELECT T1.subscriber_name, T2.insurance_provider FROM healthcare.patient_insurance AS T1 JOIN h... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "Show each 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 pairs of time entries for the same lawyer on the same date with different billing rates, including both entry IDs, the lawyer ID, the work date, and both billing rates."
},
{
"role": "assistant",
"content": "SELECT a.entry_id AS entry1_id, b.entry_id AS entry2_... | You are an SQL statement expert. Given the table 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": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count."
},
{
"role": "assistant",
"content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHE... | You are an SQL statement expert. Given the table 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": "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 documents are there for each document_type? Show document_type and count ordered by the count in descending order."
},
{
"role": "assistant",
"content": "SELECT document_type,\n COUNT(*) AS count\nFROM legal_services.documents\nGROUP BY document_type\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "How many documents were uploaded in the year 2023?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;"
}
] | You are an SQL statement expert. Given the table 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": "Show the plan name and insurance provider for all insurance plans along with the total number of unique patients enrolled in each plan."
},
{
"role": "assistant",
"content": "SELECT ip.plan_name, ip.insurance_provider, COUNT(DISTINCT pi.patient_id) AS enrolled_patie... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "Show me the first name, last name, and email for all clients registered in January 2023."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE EXTRACT(YEAR FROM date_registered) = 2023 AND EXTRACT(MONTH FROM dat... | You are an SQL statement expert. Given the table 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": "Show each service's name along with the total number of appointments scheduled and the number of unique locations these appointments are scheduled at."
},
{
"role": "assistant",
"content": "SELECT s.service_name, COUNT(a.application_id) AS appointment_count, COUNT(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.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show me all police report documents uploaded in the last month, along with their claim IDs and file sizes in MB."
},
{
"role": "assistant",
"content": "SELECT claim_id, file_size_bytes / (1024 * 1024) AS file_size_mb FROM insurance.claim_documents WHERE document_typ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "Now, sort the results by the date opened, oldest first, and show only the top 10."
},
{
"role": "assistant",
"content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Cri... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t... |
[
{
"role": "user",
"content": "List each vehicle and the date of its most recent maintenance, including the service type and cost."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_type, cost, service_date FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY vehicle_id ORDER BY service... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_ty... |
[
{
"role": "user",
"content": "List the wallet IDs and creation timestamps for all wallets created after '2023-01-01'."
},
{
"role": "assistant",
"content": "SELECT wallet_id, created_at FROM web3.wallets WHERE created_at > '2023-01-01';"
},
{
"role": "user",
"content": "Can you modif... | You are an SQL statement expert. Given the table 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": "Find all medical records where the treatment plan includes 'physical therapy' and the patient has an active primary insurance plan, showing the patient ID, record date, and insurance provider details."
},
{
"role": "assistant",
"content": "SELECT mr.patient_id, mr.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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List all invoices that were paid within 7 days of their issue date. Show invoice number, issue date, payment date, and total amount."
},
{
"role": "assistant",
"content": "SELECT invoice_number, issue_date, payment_date, total_amount FROM legal_services.invoices WHE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.