conversations listlengths 2 8 | system stringlengths 301 7.4k |
|---|---|
[
{
"role": "user",
"content": "List all claim documents of type 'POLICE_REPORT' uploaded in June 2024. Show document_id, claim_id, and file_name."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_name\nFROM insurance.claim_documents\nWHERE document_type = 'POLICE_REPORT'\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.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"role": "user",
"content": "Show me all smart contracts along with the email address of the user who owns the wallet corresponding to the contract's creator address."
},
{
"role": "assistant",
"content": "SELECT sc.contract_id, sc.creator_address, u.email\nFROM blockchain.smart_contracts sc\nJ... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp tim... |
[
{
"role": "user",
"content": "Show me all policies that expired in the last 60 days, along with their product IDs and premium amounts."
},
{
"role": "assistant",
"content": "SELECT policy_id, product_id, premium_amount, end_date FROM insurance.policies WHERE status = 'Expired' AND end_date >= CU... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "Show the first and last names of citizens who appear in both the appointments table and the payments table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name , T1.last_name FROM government_services.citizens AS T1 JOIN government_services.appointm... | You are an SQL statement expert. Given the table 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": "List all pairs of securities that are issued by the same issuer but trade on different exchanges. Show the ticker symbols and exchanges for both securities as symbol_a, exchange_a, symbol_b, exchange_b, and include issuer_name."
},
{
"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 financial_services.securities ( security_id text, ticker_symbol text, isin_code text, cusip_code text, security_name te... |
[
{
"role": "user",
"content": "Show me a list of all notifications that are related to comments. Include the notification ID, the recipient user ID, and the target entity ID, which corresponds to the comment ID."
},
{
"role": "assistant",
"content": "SELECT notification_id, recipient_user_id, tar... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t... |
[
{
"role": "user",
"content": "List all premium payments made after April 1, 2024, including the payment_id, policy_id, customer_id, and amount_paid."
},
{
"role": "assistant",
"content": "SELECT payment_id, policy_id, customer_id, amount_paid\nFROM insurance.premium_payments\nWHERE payment_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.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo... |
[
{
"role": "user",
"content": "What is the count of securities for each currency in the 'Energy' sector?"
},
{
"role": "assistant",
"content": "SELECT currency, COUNT(*) as security_count FROM financial_services.securities WHERE sector = 'Energy' GROUP BY currency;"
}
] | You are an SQL statement expert. Given the table 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.securities ( security_id character varying(64) NOT NULL, ticker_symbol character varying(20) NOT NUL... |
[
{
"role": "user",
"content": "List the post_id and the count of distinct hashtags associated with each post that has at least 3 hashtags."
},
{
"role": "assistant",
"content": "SELECT ph.post_id, COUNT(DISTINCT ph.hashtag_id) AS hashtag_count FROM social_media.post_hashtags ph GROUP BY ph.post_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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List all token symbols on the 'Ethereum' chain with a Realized Ratio greater than 0.9. Show the symbol and realized ratio."
},
{
"role": "assistant",
"content": "SELECT token_symbol, realized_ratio FROM smart_money_token_performance WHERE chain = 'Ethereum' AND real... | You are an SQL statement expert. Given the table 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": "Retrieve the top 5 players by the number of distinct achievements unlocked. Show player_id and distinct_unlocks."
},
{
"role": "assistant",
"content": "SELECT p.player_id, COUNT(DISTINCT pa.achievement_id) AS distinct_unlocks\nFROM gaming_technology.players p\nJOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ... |
[
{
"role": "user",
"content": "How many distinct ports have been used by peers in the system?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT port) AS distinct_port_count\nFROM trading_platform.peers;"
}
] | You are an SQL statement expert. Given the table 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": "What is the average interest rate for auto loans (loan_type = 'Auto') with a principal amount between $20,000 and $50,000?"
},
{
"role": "assistant",
"content": "SELECT AVG(interest_rate) AS average_interest_rate FROM financial_services.loans WHERE loan_type = 'Auto... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo... |
[
{
"role": "user",
"content": "Show me the top 3 narratives by 24-hour trading volume, along with their 1-hour and 24-hour price change percentages."
},
{
"role": "assistant",
"content": "SELECT narrative, volume_24h, price_change_percentage_1h, price_change_percentage_24h FROM narrative_info ORD... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE narrative_info (",
"narrative character varying(512) NOT NULL, -- the id of narrative",
"top_3_coins text, --... |
[
{
"role": "user",
"content": "Show me the total fuel cost for each trip along with the trip's route number and the type of the route."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, r.route_number, r.type, SUM(f.total_cost) AS total_fuel_cost\nFROM transportation.trips t\nJOIN transport... | You are an SQL statement expert. Given the table 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 average interest rate for loans of type 'Mortgage'?"
},
{
"role": "assistant",
"content": "SELECT AVG(interest_rate) FROM financial_services.loans WHERE loan_type = 'Mortgage'"
},
{
"role": "user",
"content": "Refine this to only include loan... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id.text, account_id.text, loan_type.text, principal_amount.numeric, current_principal_b... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 3 months, along with their narrative information if available."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name, pfr.valuation, pfr.rounds_name, pfr.investment_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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "Find all patients who have insurance plans with group numbers, showing their patient IDs and the count of such plans per patient, ordered by count in descending order."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(*) AS group_plan_count\nFROM healt... | You are an SQL statement expert. Given the table 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": "List each item's name, type, and rarity, along with the currency in which it can be purchased and its cost."
},
{
"role": "assistant",
"content": "SELECT item_name, item_type, rarity, cost_currency, cost_amount FROM gaming_technology.in_game_items;"
},
{
"ro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.in_game_items (
item_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the ite... |
[
{
"role": "user",
"content": "List each genre and the number of games in that genre."
},
{
"role": "assistant",
"content": "SELECT genre,\n COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY genre;"
},
{
"role": "user",
"content": "Now filter to only include genres ... | You are an SQL statement expert. Given the table 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": "Show me all insurance plans that have more than 3 patients enrolled as their primary insurance, along with the provider name and count of patients, sorted by patient count in descending order."
},
{
"role": "assistant",
"content": "SELECT ip.insurance_provider, COUN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "Show me all accounts (account_id, account_number, account_type, balance, currency) for customers whose status is 'VIP'."
},
{
"role": "assistant",
"content": "SELECT a.account_id, a.account_number, a.account_type, a.balance, a.currency FROM financial_services.accoun... | You are an SQL statement expert. Given the table 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": "Find all patients who have both an emergency contact and a phone number, and show their full names along with the emergency contact name and phone number, sorted by last name."
},
{
"role": "assistant",
"content": "SELECT CONCAT(first_name, ' ', last_name) AS patien... | You are an SQL statement expert. Given the table 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": "Which hashtags appear on the most posts? Return hashtag_id, tag_name, and the number of posts each hashtag is used in, sorted descending, limited to the top 3."
},
{
"role": "assistant",
"content": "SELECT\n h.hashtag_id,\n h.tag_name,\n COUNT(ph.post_id) AS post... | You are an SQL statement expert. Given the table 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": "What is the total count of game sessions recorded?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM gaming_technology.game_sessions;"
},
{
"role": "user",
"content": "Now, only count sessions that lasted longer than 1 hour."
},
{
"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 gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "How many applications are currently pending review? Please group the results by assigned_employee_id."
},
{
"role": "assistant",
"content": "SELECT assigned_employee_id, COUNT(*) AS pending_applications FROM government_services.applications WHERE status = 'Pending' ... | You are an SQL statement expert. Given the table 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.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, statu... |
[
{
"role": "user",
"content": "List all servers that are currently online. Show their name, region, current player count, and maximum player capacity."
},
{
"role": "assistant",
"content": "SELECT server_name, region, current_players, max_players FROM gaming_technology.servers WHERE status = 'onl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara... |
[
{
"role": "user",
"content": "Show me all invoice numbers together with the client IDs and related case IDs for invoices issued after March 1st, 2024."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, case_id FROM legal_services.invoices WHERE issue_date > '2024-03-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 legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invo... |
[
{
"role": "user",
"content": "Show me all nodes that haven't been seen in the last 24 hours."
},
{
"role": "assistant",
"content": "SELECT node_id,\n ip_address,\n port,\n last_seen\nFROM blockchain.nodes\nWHERE last_seen < NOW() - INTERVAL '24 hours';"
},
{
"role": "us... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.nodes ( node_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port integer NOT ... |
[
{
"role": "user",
"content": "List all developers founded before the year 2000, showing their name, country, and the year they were founded."
},
{
"role": "assistant",
"content": "SELECT name, country, founded_year FROM gaming_technology.developers WHERE founded_year < 2000;"
},
{
"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 gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "List all agents along with their manager's first and last name for agents whose status is 'active'."
},
{
"role": "assistant",
"content": "SELECT a.agent_id,\n a.first_name AS agent_first_name,\n a.last_name AS agent_last_name,\n m.agent_id AS mana... | You are an SQL statement expert. Given the table 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": "For the 'DeFi' narrative, what is the average ROI and the total net inflow (usd_value where type=1) from smart money token inflow?"
},
{
"role": "assistant",
"content": "SELECT AVG(sm.roi) AS avg_roi, SUM(smt.usd_value) AS total_net_inflow\nFROM smart_money_token_in... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "List all depots (location type 'Depot') and the number of vehicles assigned to each. Include the depot name and city."
},
{
"role": "assistant",
"content": "SELECT T1.name , T1.city , COUNT(T2.vehicle_id) FROM transportation.locations AS T1 LEFT JOIN transportatio... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "List all appointments showing the appointment ID, the citizen's full name, and the name of the service associated with the appointment."
},
{
"role": "assistant",
"content": "SELECT appt.appointment_id, c.first_name || ' ' || c.last_name AS citizen_full_name, s.serv... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "I would like to list each appointment along with any associated medical record's chief complaint, including the appointment_id, appointment_time, and chief_complaint. Include appointments even if there's no medical record."
},
{
"role": "assistant",
"content": "SELE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "Find the top 3 drivers by their average number of passengers per trip, including driver_id, first_name, last_name, and avg_passengers, ordered by avg_passengers descending."
},
{
"role": "assistant",
"content": "SELECT d.driver_id,\n d.first_name,\n d.la... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Show me the top 5 users who have the highest total trade volume (quantity * price) as buyers, along with their email addresses and the number of distinct assets they traded."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(DISTINCT t.asset_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 trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "List all room types along with the name of the property they belong to. Show the room type name, property name, and base rate."
},
{
"role": "assistant",
"content": "SELECT t1.type_name, t2.property_name, t1.base_rate FROM hospitality_technology.room_types AS t1 JOI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu... |
[
{
"role": "user",
"content": "特定の職種の従業員情報を取得したいです。従業員ID、名前、職種、雇用日を表示してください。"
},
{
"role": "assistant",
"content": "db.employees.find(\n { job_title: '<specific_job_title>' },\n { employee_id: 1, first_name: 1, last_name: 1, job_title: 1, hire_date: 1, _id: 0 }\n).sort({ hire_date: -1 })"
... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Collection 'assembly_steps'. Document structure: { _id: <ObjectId (or step_id)>, step_id: String,... |
[
{
"role": "user",
"content": "List all pairs of hashtags that were created on the same date. Show both tag names and the creation date."
},
{
"role": "assistant",
"content": "SELECT a.tag_name AS tag1, b.tag_name AS tag2, a.created_at::date AS created_date\nFROM social_media.hashtags a\nJOIN soc... | You are an SQL statement expert. Given the table 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": "Show me the block with the earliest timestamp and its corresponding previous block's difficulty level."
},
{
"role": "assistant",
"content": "SELECT b1.block_id, b1.timestamp, b2.difficulty AS previous_block_difficulty FROM blockchain.blocks b1 LEFT JOIN blockchain.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "Find all DApps that have been interacted with by users who have wallets with more than 1000 in their order quantities."
},
{
"role": "assistant",
"content": "SELECT DISTINCT d.dapp_id, d.name, d.description FROM trading_platform.dapps d JOIN trading_platform.orders ... | You are an SQL statement expert. Given the table 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": "For each appointment, show the appointment ID, the associated citizen's full name, and the document types they have uploaded for that appointment's application."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, c.first_name || ' ' || c.last_name AS cit... | You are an SQL statement expert. Given the table 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": "How many players are registered for each country? Return the country_code and the player count."
},
{
"role": "assistant",
"content": "SELECT country_code, COUNT(*) AS player_count FROM gaming_technology.players GROUP BY country_code;"
},
{
"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.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "Show me a list of all doctors who have made at least one diagnosis along with the total number of diagnoses they have made."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(di.diagnosis_id) AS diagnosis_count\nFROM healthca... | You are an SQL statement expert. Given the table 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 total fuel cost for each vehicle, grouped by fuel type."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, fuel_type, SUM(total_cost) AS total_fuel_cost FROM transportation.fuel_logs GROUP BY vehicle_id, fuel_type;"
},
{
"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 transportation.locations ( location_id character varying(64) NOT NULL, name character varying(255) NOT NULL, type chara... |
[
{
"role": "user",
"content": "Which agencies offer services with a standard fee greater than 100? List the agency name and the corresponding service names."
},
{
"role": "assistant",
"content": "SELECT T1.agency_name, T2.service_name FROM government_services.agencies AS T1 INNER JOIN government_... | You are an SQL statement expert. Given the table 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": "Can you show me all developers along with the year they were founded and their website, grouped by country?"
},
{
"role": "assistant",
"content": "SELECT country, array_agg(name) AS developers, array_agg(founded_year) AS founded_years, array_agg(website) AS websites... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_year.integer, website.text, created_... |
[
{
"role": "user",
"content": "For each sender address that has sent at least 10 transactions, show the address and the total gas used by their transactions."
},
{
"role": "assistant",
"content": "SELECT from_address, SUM(gas_used) AS total_gas_used\nFROM web3.transactions\nGROUP BY from_address\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.numeric, gas_used.integer, gas_price... |
[
{
"role": "user",
"content": "Show the first name, last name, and the date they joined (created_at) for all passengers."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, created_at FROM transportation.passengers;"
},
{
"role": "user",
"content": "Only include passe... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "List the first name, last name, and job title for all employees."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, job_title FROM financial_services.employees;"
},
{
"role": "user",
"content": "Only show employees who are currently act... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "Retrieve medical_record IDs, patient IDs, and record dates for patients born before January 1st, 1980."
},
{
"role": "assistant",
"content": "SELECT mr.record_id, mr.patient_id, mr.record_date\nFROM healthcare.medical_records mr\nJOIN healthcare.patients p\n ON mr.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Find beneficiaries with percentage_share above 50% for policies that have any claim with estimated_loss greater than 20000. Show beneficiary_id, first_name, last_name, and policy_id."
},
{
"role": "assistant",
"content": "SELECT pb.beneficiary_id, pb.first_name, pb.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"role": "user",
"content": "Which rooms on the 4th floor are non-smoking, along with their property IDs and type IDs?"
},
{
"role": "assistant",
"content": "SELECT room_id, property_id, room_number, room_type_id FROM hospitality_technology.rooms WHERE floor = 4 AND is_smoking = FALSE;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room... |
[
{
"role": "user",
"content": "Show me the count of documents uploaded by each lawyer. Display the uploader ID and the total count of documents."
},
{
"role": "assistant",
"content": "SELECT uploaded_by_lawyer_id, COUNT(*) AS document_count FROM documents GROUP BY uploaded_by_lawyer_id;"
},
{... | You are an SQL statement expert. Given the table 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 cases are associated with each unique lead lawyer ID? Show the lead lawyer ID and the count of cases, but only for lawyers who lead at least 5 cases. Sort the results by the case count in descending order."
},
{
"role": "assistant",
"content": "SELECT lead_... | You are an SQL statement expert. Given the table 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 full names and contact emails of citizens who have received notifications via 'SMS'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name, c.last_name, c.contact_email\nFROM government_services.citizens c\nJOIN government_services.notifica... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show me all active managers along with their property IDs and the number of staff members they supervise, ordered by the number of supervised staff in descending order."
},
{
"role": "assistant",
"content": "SELECT s.staff_id, s.property_id, s.first_name, s.last_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 hospitality_technology.staff (
staff_id character varying(64) NOT NULL, -- unique identifier for the staff member
... |
[
{
"role": "user",
"content": "List all pairs of fuel log entries for the same vehicle that occurred more than 7 days apart, showing vehicle_id, first_log_id, second_log_id, and the time difference in days."
},
{
"role": "assistant",
"content": "SELECT f1.vehicle_id,\n f1.fuel_log_id AS fir... | You are an SQL statement expert. Given the table 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.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu... |
[
{
"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": "Show me all policy beneficiaries who were added in the last 6 months, along with their full names and relationship to the policyholder."
},
{
"role": "assistant",
"content": "SELECT beneficiary_id, policy_id, first_name, last_name, relationship, percentage_share FRO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "Count how many follow relationships were created in June 2024."
},
{
"role": "assistant",
"content": "SELECT COUNT(follow_id) FROM social_media.follows WHERE created_at >= '2024-06-01' AND created_at < '2024-07-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u... |
[
{
"role": "user",
"content": "For each property, show the property name, average price of available services, and the maximum price of available services."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n AVG(s.price) AS avg_price,\n MAX(s.price) AS max_price\nFROM hos... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "How many beneficiaries has each unique relationship type? List relationship and the count."
},
{
"role": "assistant",
"content": "SELECT relationship, COUNT(*) AS beneficiary_count\nFROM insurance.policy_beneficiaries\nGROUP BY relationship;"
}
] | You are an SQL statement expert. Given the table 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 all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and amount."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, amount FROM nft_holders WHERE contract_type = 'ERC1155' AND CAST(amount AS decimal... | You are an SQL statement expert. Given the table 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": "For each service location, find its nearest accessible location by geographic distance."
},
{
"role": "assistant",
"content": "SELECT sl.location_id,\n sl.location_name,\n nearest.location_id AS nearest_location_id,\n nearest.location_name AS nea... | You are an SQL statement expert. Given the table 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.service_locations ( location_id.text, agency_id.text, location_name.text, address.text, city.text, ... |
[
{
"role": "user",
"content": "Could you show me a list of posts, including their content, and the total number of comments and likes each post has received?"
},
{
"role": "assistant",
"content": "SELECT\n p.post_id,\n p.content,\n COUNT(DISTINCT c.comment_id) AS comment_count,\n COUNT(DISTIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List all agents who have a commission rate above 0.1, showing their full names and agency names."
},
{
"role": "assistant",
"content": "SELECT agent_id, first_name || ' ' || last_name AS full_name, agency_name, commission_rate FROM insurance.agents WHERE commission_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "For each game, show the game_id, title, the number of servers currently online, and the total current_players on those servers."
},
{
"role": "assistant",
"content": "SELECT g.game_id, g.title, COUNT(s.server_id) AS online_servers, SUM(s.current_players) AS total_on... | You are an SQL statement expert. Given the table 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 citizen who has at least one document pending verification and at least one appointment not completed, display the citizen's full name, the document type, the document's upload timestamp, the appointment ID, and the appointment status."
},
{
"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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show me all business center services (category = 'Business Center') along with their property IDs and descriptions, where the service is available."
},
{
"role": "assistant",
"content": "SELECT service_name, property_id, description FROM hospitality_technology.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 hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "Give me the total number of doctors for each 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 text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "Show me all transactions (transaction_id, amount, transaction_type) where the status is 'Completed' and the transaction_date is within the last 30 days, along with the security details (ticker_symbol, security_name) for securities traded on the same day as the transaction."
}... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions ( transaction_id.text, account_id.text, related_account_id.text, transaction_type.text,... |
[
{
"role": "user",
"content": "Show me the top 3 buyers by total trade quantity, along with the average price they paid per trade."
},
{
"role": "assistant",
"content": "SELECT buyer_id, SUM(quantity) AS total_quantity, AVG(price) AS avg_price FROM trading_platform.trades GROUP BY buyer_id ORDER ... | You are an SQL statement expert. Given the table 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.trades ( trade_id text, order_id text, buyer_id text, seller_id text, asset_id text, quantity numeric,... |
[
{
"role": "user",
"content": "List the NDC code and description for any medication that has an NDC code starting with '5'."
},
{
"role": "assistant",
"content": "SELECT ndc_code, description FROM healthcare.medications WHERE ndc_code LIKE '5%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "Find any two claims made by the same customer on the same day. Return customer_id, the two claim IDs, and the incident date."
},
{
"role": "assistant",
"content": "SELECT c1.customer_id,\n c1.claim_id AS claim1_id,\n c2.claim_id AS claim2_id,\n 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 insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "How many unread messages does each sender have? Show sender_user_id and count of messages where read_at is null."
},
{
"role": "assistant",
"content": "SELECT sender_user_id, COUNT(*) AS unread_messages\nFROM social_media.messages\nWHERE read_at IS NULL\nGROUP BY se... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.messages ( message_id.text, conversation_id.text, sender_user_id.text, content.text, media_url.text, media... |
[
{
"role": "user",
"content": "Find the total number of likes made on posts versus comments. Show two columns: like_type (either 'post' or 'comment') and like_count."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN post_id IS NOT NULL THEN 'post' ELSE 'comment' END AS like_type, COUNT(*) 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 social_media.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
|
[
{
"role": "user",
"content": "List all doctors who have a hospital affiliation and include their specialty and affiliation ID."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, specialty, hospital_affiliation_id FROM healthcare.doctors WHERE hospital_affiliation_id IS NOT NULL... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "For each appointment scheduled for '2024-08-15', return the patient's full name, the doctor's ID, and the appointment time."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, a.doctor_id, a.appointment_time\nFROM healthcare.appointments a\nJOIN... | You are an SQL statement expert. Given the table 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": "Which diagnosis codes have been used for more than 5 different patients? Show the diagnosis_code and the patient count."
},
{
"role": "assistant",
"content": "SELECT diagnosis_code, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.diagnoses GROUP BY diagn... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2