system stringlengths 560 8.8k | conversations listlengths 2 34 |
|---|---|
You are an expert in writing database language and you can refuse the user's question if the question is not related to the table structure. 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
CREA... | [
{
"role": "user",
"content": "What is the schedule of trains arriving at station with ID 'ST789' tomorrow?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide the train schedule for station ID 'ST789' as this information is not available in the current database. The table only ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- uni... | [
{
"role": "user",
"content": "Find all pairs of citizens who share the same first name and gender but have different last names. Display the shared first name, gender, the full name of the first citizen in the pair, and the full name of the second citizen."
},
{
"role": "assistant",
"content": "... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- uni... | [
{
"role": "user",
"content": "List the names of active services and their categories provided by agencies with a 'Federal' jurisdiction level."
},
{
"role": "assistant",
"content": "SELECT T1.service_name, T1.category FROM government_services.services AS T1 JOIN government_services.agencies AS T... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text... | [
{
"role": "user",
"content": "Show me each law firm's ID, name, managing_partner_id, and the number of appointments scheduled with that managing partner."
},
{
"role": "assistant",
"content": "SELECT f.firm_id, \n f.firm_name, \n f.managing_partner_id, \n COUNT(a.appointment_id... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, post_id character ... | [
{
"role": "user",
"content": "How many likes were given to comments in June 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS comment_likes_count\nFROM social_media.likes\nWHERE comment_id IS NOT NULL \n AND DATE_TRUNC('month', created_at) = '2024-06-01';"
},
{
"role": "us... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text,... | [
{
"role": "user",
"content": "Show the names and emails of all guests who have communication consent enabled."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM hospitality_technology.guests WHERE communication_consent = TRUE;"
},
{
"role": "user",
"conte... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifie... | [
{
"role": "user",
"content": "For each user with at least two wallets, calculate the average time difference in hours between consecutive wallet creations. Return user_id and avg_diff_hours."
},
{
"role": "assistant",
"content": "SELECT user_id, AVG(EXTRACT(EPOCH FROM (created_at - prev_created)... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE gaming_technology.player_achievements ( player_achievement_id.uuid, player_id.uuid, a... | [
{
"role": "user",
"content": "List each player's most recent achievement unlock, showing the player_id, achievement_id, and unlocked_at timestamp."
},
{
"role": "assistant",
"content": "SELECT pa.player_id, pa.achievement_id, pa.unlocked_at FROM gaming_technology.player_achievements pa INNER JOI... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text,... | [
{
"role": "user",
"content": "List all active products with a base premium exceeding 1500 that were created after January 1, 2023, including their product name, type, and base premium. Order the results by creation date ascending."
},
{
"role": "assistant",
"content": "SELECT product_name, produ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE hospitality_technology.reviews ( review_id.text, property_id.text, reservation_id.tex... | [
{
"role": "user",
"content": "Count reviews with an overall rating of 5 for each property."
},
{
"role": "assistant",
"content": "SELECT property_id, COUNT(*) AS five_star_review_count FROM hospitality_technology.reviews WHERE rating_overall = 5 GROUP BY property_id;"
},
{
"role": "user"... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text,... | [
{
"role": "user",
"content": "What are the top 5 product types by average base premium, showing the product_type and average base_premium, ordered by average base_premium descending?"
},
{
"role": "assistant",
"content": "SELECT product_type, AVG(base_premium) AS avg_premium FROM insurance.insur... |
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 trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details t... | [
{
"role": "user",
"content": "Count the number of logs for each action type."
},
{
"role": "assistant",
"content": "SELECT action,\n COUNT(*) AS count\nFROM trading_platform.logs\nGROUP BY action;"
},
{
"role": "user",
"content": "What is the reason for the termination of emplo... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birt... | [
{
"role": "user",
"content": "For each claim, show the corresponding product_type of the insurance product for the related policy."
},
{
"role": "assistant",
"content": "SELECT cl.claim_id, ip.product_type\nFROM insurance.claims cl\nJOIN insurance.policies p ON cl.policy_id = p.policy_id\nJOIN i... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth... | [
{
"role": "user",
"content": "List each insurance provider with the count of primary active policies (is_primary = TRUE and expiration_date IS NULL or expiration_date > CURRENT_DATE). Return the provider and the count."
},
{
"role": "assistant",
"content": "SELECT ip.insurance_provider, COUNT(*)... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character... | [
{
"role": "user",
"content": "List all appointments that are currently scheduled and show their appointment time."
},
{
"role": "assistant",
"content": "SELECT appointment_id, patient_id, doctor_id, appointment_time FROM healthcare.appointments WHERE status = 'Scheduled';"
},
{
"role": "... |
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 trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, as... | [
{
"role": "user",
"content": "Show me the total count and sum of amounts for spent and unspent UTXOs for each asset, including the asset name and symbol."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name AS asset_name, a.symbol, u.spent, COUNT(*) AS utxo_count, SUM(u.amount) AS to... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, docume... | [
{
"role": "user",
"content": "For each document_name in each case, retrieve the latest version number and its document_id."
},
{
"role": "assistant",
"content": "SELECT case_id,\n document_name,\n MAX(version) AS latest_version\nFROM legal_services.documents\nGROUP BY case_id, docume... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the toke... | [
{
"role": "user",
"content": "For each chain, which token had the highest number of smart money addresses buying it this week? Show the token symbol and narrative too."
},
{
"role": "assistant",
"content": "SELECT chain, token_symbol, narrative, MAX(address_amount) AS max_buyers FROM smart_money... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id uuid, player_id uuid, game_id uuid, serv... | [
{
"role": "user",
"content": "For each game, which server has hosted the most sessions?"
},
{
"role": "assistant",
"content": "SELECT game_id, server_id, COUNT(*) AS session_count FROM gaming_technology.game_sessions GROUP BY game_id, server_id;"
},
{
"role": "user",
"content": "I wa... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id char... | [
{
"role": "user",
"content": "Find the claim ID and the total number of documents associated with each claim ID that has more than 10 documents."
},
{
"role": "assistant",
"content": "SELECT claim_id, COUNT(*) FROM insurance.claim_documents GROUP BY claim_id HAVING COUNT(*) > 10;"
},
{
"... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin... | [
{
"role": "user",
"content": "Show the wallet address, token symbol, and the total value received by each wallet for each token. Only include wallets that have received tokens."
},
{
"role": "assistant",
"content": "SELECT w.address AS wallet_address, t.token_symbol, SUM(tt.value) AS total_recei... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.premium_payments (
payment_id character varying(64) NOT NULL, -- unique... | [
{
"role": "user",
"content": "How many premium payments are currently in 'Pending' status?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM insurance.premium_payments WHERE status = 'Pending';"
},
{
"role": "user",
"content": "How many notifications have been sent by each ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, od... | [
{
"role": "user",
"content": "Can you provide the mechanic name, service date, and service type for each maintenance log, along with the vehicle's odometer reading for all logs with a cost greater than 1000?"
},
{
"role": "assistant",
"content": "SELECT mechanic_name, service_date, service_type,... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin... | [
{
"role": "user",
"content": "Find all contracts deployed by users who have also conducted transactions with a value greater than 1 ETH (where 1 ETH = 1e18 wei)."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.contract_id, c.address, c.deployer_address FROM web3.contracts c JOIN web3.tr... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.claim_documents ( document_id text, claim_id text, document_type text, file... | [
{
"role": "user",
"content": "For each claim, retrieve the document_id, file_name, and uploaded_at of the earliest and the latest uploaded document."
},
{
"role": "assistant",
"content": "SELECT\n c1.claim_id,\n c1.document_id AS earliest_document_id,\n c1.file_name AS earliest_file_nam... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, ... | [
{
"role": "user",
"content": "How many payments were made using the payment method 'Credit Card'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS credit_card_payments\nFROM government_services.payments\nWHERE payment_method = 'Credit Card';"
},
{
"role": "user",
"content": ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, ... | [
{
"role": "user",
"content": "Provide a list of passengers including their passenger_id, first_name, last_name, phone_number, and the total number of bookings they have made. Sort the result by booking count in descending order."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id,\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 social_media.hashtags ( hashtag_id.text, tag_name.text, created_at.timestamp )
CREATE... | [
{
"role": "user",
"content": "How many notifications are there for each distinct notification type?"
},
{
"role": "assistant",
"content": "SELECT notification_type, COUNT(*) FROM social_media.notifications GROUP BY notification_type;"
},
{
"role": "user",
"content": "What is the aver... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name... | [
{
"role": "user",
"content": "List pairs of drivers who share the same hire_date, showing both driver IDs and the hire_date."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id,\n d2.driver_id AS driver2_id,\n d1.hire_date\nFROM transportation.drivers d1\nJOIN tr... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), userna... | [
{
"role": "user",
"content": "For each player, show the player_id and the count of inventory items they acquired with a quantity greater than 1."
},
{
"role": "assistant",
"content": "SELECT player_id, COUNT(inventory_id) AS items_qty_gt_1_count FROM gaming_technology.player_inventory WHERE quan... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.likes (
like_id character varying(64) NOT NULL, -- unique identifier... | [
{
"role": "user",
"content": "Count the total number of likes on posts versus likes on comments across the entire platform."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN post_id IS NOT NULL THEN 'post' ELSE 'comment' END AS like_target, COUNT(*) AS total_likes FROM social_media.likes G... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name characte... | [
{
"role": "user",
"content": "What is the average commission rate for all active agents?"
},
{
"role": "assistant",
"content": "SELECT AVG(commission_rate) FROM agents WHERE status = 'Active';"
},
{
"role": "user",
"content": "Show a list of diagnoses along with the chief complaint 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 legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique ide... | [
{
"role": "user",
"content": "List all law firms that share the same address with another firm, showing both firm names and the address."
},
{
"role": "assistant",
"content": "SELECT f1.firm_name AS firm_a, f2.firm_name AS firm_b, f1.address\nFROM law_firms f1\nJOIN law_firms f2\n ON f1.address... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id charac... | [
{
"role": "user",
"content": "For each booking, show the booking_id, seat_number, fare, and the city of the origin location for the trip that was booked."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, b.seat_number, b.fare, orig.city AS origin_city\nFROM transportation.bookings b\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 transportation.fuel_logs (
fuel_log_id character varying(64) NOT NULL, -- unique... | [
{
"role": "user",
"content": "For each fuel_type, can you calculate the total total_cost and the average total_cost from the fuel_logs table?"
},
{
"role": "assistant",
"content": "SELECT fuel_type,\n SUM(total_cost) AS total_cost_sum,\n AVG(total_cost) AS average_cost\nFROM transpor... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin... | [
{
"role": "user",
"content": "For each user, count the number of distinct smart contracts they have called. Return user_id, username, and contract_count, ordered by contract_count descending."
},
{
"role": "assistant",
"content": "SELECT u.user_id,\n u.username,\n COUNT(DISTINCT tx.t... |
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 trading_platform.users ( user_id character varying(64) NOT NULL, username character v... | [
{
"role": "user",
"content": "How many DApps have names that start with the letter 'A'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS dapp_count\nFROM trading_platform.dapps\nWHERE name LIKE 'A%';"
},
{
"role": "user",
"content": "List all address IDs and their correspond... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique i... | [
{
"role": "user",
"content": "Get a list of appointment_id, start_time, and invoice_number for appointments that have a related invoice."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id,\n a.start_time,\n i.invoice_number\nFROM legal_services.appointments a\nJOIN legal_... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.employees (
employee_id character varying(64) NOT NULL, -- un... | [
{
"role": "user",
"content": "Which department has the highest number of employees currently employed?"
},
{
"role": "assistant",
"content": "SELECT department FROM government_services.employees WHERE termination_date IS NULL GROUP BY department ORDER BY COUNT(*) DESC LIMIT 1;"
},
{
"rol... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique ident... | [
{
"role": "user",
"content": "Retrieve the most recent log entry for each user, including action and logged_at."
},
{
"role": "assistant",
"content": "SELECT l1.user_id,\n l1.action,\n l1.logged_at\nFROM trading_platform.logs l1\nWHERE l1.logged_at = (\n SELECT MAX(l2.logged_at)\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 web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique ide... | [
{
"role": "user",
"content": "List all token transfers with a value greater than 1000000. Show transfer ID, token ID, from address, to address, and value."
},
{
"role": "assistant",
"content": "SELECT\n transfer_id,\n token_id,\n from_address,\n to_address,\n value\nFROM web3.token_transfer... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE blockchain.nodes ( node_id character varying(64) NOT NULL, ip_address character varyi... | [
{
"role": "user",
"content": "List each port along with the count of distinct IP addresses observed on that port."
},
{
"role": "assistant",
"content": "SELECT port, COUNT(DISTINCT ip_address) AS unique_ip_count FROM blockchain.nodes GROUP BY port;"
},
{
"role": "user",
"content": "O... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifie... | [
{
"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 = '');"
},
{
"role": "user",
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, user_id character varyin... | [
{
"role": "user",
"content": "List all notifications of type 'like' where the target_entity_type is 'post'. For each notification, return notification_id, sender_user_id, target_entity_id (as post_id), and the notification creation time."
},
{
"role": "assistant",
"content": "SELECT notification... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.payments ( payment_id character varying(64) NOT NULL, application... | [
{
"role": "user",
"content": "For each payment method, show the total number of completed payments and the total amount paid."
},
{
"role": "assistant",
"content": "SELECT payment_method, COUNT(*) AS completed_count, SUM(amount) AS total_paid FROM government_services.payments WHERE status = 'Com... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_... | [
{
"role": "user",
"content": "I want to find all pairs of invoices belonging to the same client. Show me the client_id, the invoice_number for the earlier invoice and the invoice_number for the later invoice."
},
{
"role": "assistant",
"content": "SELECT i1.client_id,\n i1.invoice_number A... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.likes (
like_id character varying(64) NOT NULL, -- unique identifier... | [
{
"role": "user",
"content": "Which users have received both a comment notification and a like notification? List the recipient_user_id and the total number of such users."
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT recipient_user_id) AS user_count\nFROM (\n SELECT recipient_us... |
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 trading_platform.users (
user_id character varying(64) NOT NULL, -- unique ident... | [
{
"role": "user",
"content": "List all users whose usernames start with the letter 'B'."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email, created_at FROM trading_platform.users WHERE username LIKE 'B%';"
},
{
"role": "user",
"content": "Can you make it case-inse... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, docume... | [
{
"role": "user",
"content": "List the latest version of each document (identified by case_id and document_name), showing the version number and its upload_timestamp."
},
{
"role": "assistant",
"content": "SELECT d.case_id,\n d.document_name,\n d.version AS latest_version,\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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, ... | [
{
"role": "user",
"content": "List the service_id, service_name, and agency_id for all active services that have an online application URL provided."
},
{
"role": "assistant",
"content": "SELECT service_id,\n service_name,\n agency_id\nFROM government_services.services\nWHERE is_acti... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.insurance_products (
product_id character varying(64) NOT NULL, -- uniq... | [
{
"role": "user",
"content": "Retrieve the product_id, product_name, base_premium, and created_at for all active insurance products with a base_premium greater than 1000, ordered by base_premium descending."
},
{
"role": "assistant",
"content": "SELECT\n product_id,\n product_name,\n base_pre... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, property... | [
{
"role": "user",
"content": "Give me a breakdown of available services by unit, with the count of services and the average price, grouped by property."
},
{
"role": "assistant",
"content": "SELECT property_id, unit, COUNT(*) AS service_count, AVG(price) AS avg_price FROM hospitality_technology.... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, spe... | [
{
"role": "user",
"content": "Find all doctors who have a hospital affiliation and include their full names (concatenated), specialties, and affiliation IDs."
},
{
"role": "assistant",
"content": "SELECT CONCAT(first_name, ' ', last_name) AS full_name, specialty, hospital_affiliation_id FROM hea... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, ... | [
{
"role": "user",
"content": "For each passenger, show their passenger_id, first_name, last_name, the date and time of their earliest booking, and the date and time of their latest booking."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birt... | [
{
"role": "user",
"content": "Which claims have at least one document uploaded by an agent located in 'NY'? Show the claim_id, document_type, file_name, uploaded_by, and the agent's first and last name."
},
{
"role": "assistant",
"content": "SELECT cd.claim_id, cd.document_type, cd.file_name, cd... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_lo... | [
{
"role": "user",
"content": "How many trips used more than 500 units of fuel, and what are their trip IDs and scheduled departure times?"
},
{
"role": "assistant",
"content": "SELECT t.trip_id, t.scheduled_departure, SUM(f.quantity) AS total_fuel\nFROM transportation.trips t\nJOIN transportatio... |
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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name... | [
{
"role": "user",
"content": "Which project had the largest single fundraising in each investment round, along with the round's name and introduction?"
},
{
"role": "assistant",
"content": "SELECT t1.project_name, t1.rounds_name, t1.investment_value, t1.introduction FROM project_fundraising_reco... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, applicati... | [
{
"role": "user",
"content": "List documents uploaded for applications that have received payments. Display the document ID, document type, associated application ID, and the payment amount."
},
{
"role": "assistant",
"content": "SELECT T1.document_id, T1.document_type, T1.application_id, T2.amo... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id.text, property_id.text, guest_id... | [
{
"role": "user",
"content": "List properties where actual check-in occurred later than the scheduled check-in date. Show the property ID and the count of such reservations."
},
{
"role": "assistant",
"content": "SELECT property_id, COUNT(*) FROM reservations WHERE actual_check_in_ts > check_in_... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE gaming_technology.in_game_items ( item_id.uuid, game_id.uuid, item_name.text, item_ty... | [
{
"role": "user",
"content": "I want to see pairs of items from the same game that share the same rarity but are of different types. Show each pair's names and types."
},
{
"role": "assistant",
"content": "SELECT a.game_id,\n a.item_name AS item1_name,\n a.item_type AS item1_type,\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_basic_info ( coin_id text, token_name text, token_symbol text, token_address te... | [
{
"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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id... | [
{
"role": "user",
"content": "Which cities are listed as primary_address for citizens who have a verified account? Can you show the city names and the number of verified citizens in each city?"
},
{
"role": "assistant",
"content": "SELECT SPLIT_PART(primary_address, ',', 1) AS city, COUNT(*) AS ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE gaming_technology.player_achievements (
player_achievement_id uuid NOT NULL DEFAU... | [
{
"role": "user",
"content": "Calculate for each player the timespan between their earliest and latest achievement unlocks."
},
{
"role": "assistant",
"content": "SELECT pa_min.player_id,\n pa_max.max_time - pa_min.min_time AS span\nFROM (\n SELECT player_id,\n MIN(unlocked_at) AS... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique... | [
{
"role": "user",
"content": "List all time entries where the description includes the word 'email', showing the entry ID, date worked, hours spent, and description."
},
{
"role": "assistant",
"content": "SELECT entry_id, date_worked, hours_spent, description FROM legal_services.time_entries WHE... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, addres... | [
{
"role": "user",
"content": "Find all cities that contain at least one location of type 'Depot' and at least one location of type 'Station'."
},
{
"role": "assistant",
"content": "SELECT city FROM transportation.locations WHERE type IN ('Depot', 'Station') GROUP BY city HAVING COUNT(DISTINCT CA... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, ful... | [
{
"role": "user",
"content": "List all posts along with the user emails of the authors."
},
{
"role": "assistant",
"content": "SELECT p.post_id, p.content, u.email\nFROM social_media.posts p\nJOIN social_media.users u ON p.user_id = u.user_id;"
},
{
"role": "user",
"content": "Show t... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text... | [
{
"role": "user",
"content": "Show the invoice_id and total hours logged for each invoice."
},
{
"role": "assistant",
"content": "SELECT invoice_id, SUM(hours_spent) AS total_hours FROM legal_services.time_entries WHERE invoice_id IS NOT NULL GROUP BY invoice_id;"
},
{
"role": "user",
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_times... | [
{
"role": "user",
"content": "Calculate the monthly total quantity of fuel consumed and the average cost_per_unit for each fuel_type in 2023."
},
{
"role": "assistant",
"content": "SELECT date_trunc('month', log_timestamp) AS month,\n fuel_type,\n SUM(quantity) AS total_quantity... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, ... | [
{
"role": "user",
"content": "Retrieve the vehicle_id, make, model, and the next_service_due_date for each vehicle based on the most recent maintenance log."
},
{
"role": "assistant",
"content": "SELECT DISTINCT ON (ml.vehicle_id) v.vehicle_id, v.make, v.model, ml.next_service_due_date FROM tran... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id... | [
{
"role": "user",
"content": "For each patient, find the next appointment after each one. Return patient_id, appointment_id, next_appointment_id, and the waiting time in minutes between them."
},
{
"role": "assistant",
"content": "SELECT A.patient_id,\n A.appointment_id AS current_id,\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 smart_money_profit ( address text, rank numeric, profit numeric, roi numeric, realize... | [
{
"role": "user",
"content": "How many addresses on the Ethereum chain have an ROI between 2 and 4?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE chain = 'Ethereum' AND roi >= 2 AND roi <= 4;"
},
{
"role": "user",
"content": "Co... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin... | [
{
"role": "user",
"content": "Show each token's symbol, token_name, and the deployer_address and status of the contract where that token was created."
},
{
"role": "assistant",
"content": "SELECT t.token_symbol,\n t.token_name,\n c.deployer_address,\n c.status\nFROM web3.tokens... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- uni... | [
{
"role": "user",
"content": "Which citizens have a contact email ending with '@yahoo.com' and have received at least one notification? Show their first name, last name, and email."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name, c.last_name, c.contact_email\nFROM government_... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_n... | [
{
"role": "user",
"content": "How many notifications related to services were sent for each service category in the past 7 days?"
},
{
"role": "assistant",
"content": "SELECT\n s.category,\n COUNT(n.notification_id) AS notification_count\nFROM\n government_services.notifications n\n JOIN gov... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, produc... | [
{
"role": "user",
"content": "Retrieve the count of active insurance products for each product_type and order the results by the count descending."
},
{
"role": "assistant",
"content": "SELECT product_type,\n COUNT(*) AS active_count\nFROM insurance.insurance_products\nWHERE is_active = TR... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_lo... | [
{
"role": "user",
"content": "List all completed trips, showing the trip ID, the names of the origin and destination locations for the trip, and the actual arrival time."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, loc_origin.name AS origin_location_name, loc_dest.name AS destination... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.follows ( follow_id.text, follower_user_id.text, following_user_id.text,... | [
{
"role": "user",
"content": "For each user, count how many different conversations they have participated in. Show user_id and conversation_count."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(DISTINCT conversation_id) AS conversation_count\nFROM social_media.conversation_partici... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.post_hashtags ( post_hashtag_id.text, post_id.text, hashtag_id.text )
... | [
{
"role": "user",
"content": "Find all hashtag IDs that have been used on the same posts as hashtag 'h1'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT ph2.hashtag_id FROM social_media.post_hashtags ph1 JOIN social_media.post_hashtags ph2 ON ph1.post_id = ph2.post_id WHERE ph1.hashtag_i... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.applications ( application_id text, citizen_id text, service_id t... | [
{
"role": "user",
"content": "For each citizen, show their citizen ID and the total number of applications and notifications they have."
},
{
"role": "assistant",
"content": "SELECT c.citizen_id,\n COALESCE(a.application_count, 0) AS application_count,\n COALESCE(n.notification_count... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, a... | [
{
"role": "user",
"content": "List policy pairs for the same customer where one policy was cancelled and another active policy started within 30 days after the cancellation. Show customer_id, cancelled policy_number, cancellation_date, active policy_number, start_date."
},
{
"role": "assistant",
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_lo... | [
{
"role": "user",
"content": "Show me all pairs of routes where both routes have the same origin_location_id but different destination_location_id values. For each pair, display the first route's route_number, the second route's route_number, and their origin_location_id."
},
{
"role": "assistant",
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for ... | [
{
"role": "user",
"content": "Count how many tokens exist for each contract_address."
},
{
"role": "assistant",
"content": "SELECT contract_address,\n COUNT(*) AS token_count\nFROM web3.tokens\nGROUP BY contract_address;"
},
{
"role": "user",
"content": "Now only include contra... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique... | [
{
"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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.t... | [
{
"role": "user",
"content": "Count the total number of employees who have a direct manager assigned."
},
{
"role": "assistant",
"content": "SELECT COUNT(employee_id) FROM government_services.employees WHERE manager_employee_id IS NOT NULL;"
},
{
"role": "user",
"content": "List the ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdic... | [
{
"role": "user",
"content": "Provide the message_subject and agency_name for all notifications that are related to agencies and have a status of 'Sent'."
},
{
"role": "assistant",
"content": "SELECT n.message_subject, a.agency_name\nFROM government_services.notifications n\nJOIN government_serv... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id text PRIMARY KEY, reservation_id tex... | [
{
"role": "user",
"content": "Get the total_quantity and total_revenue (sum of total_price) for each staff member who placed orders (staff_id_ordered)."
},
{
"role": "assistant",
"content": "SELECT staff_id_ordered,\n SUM(quantity) AS total_quantity,\n SUM(total_price) AS total_reven... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid PRIMARY KEY, game_id uuid, server_name tex... | [
{
"role": "user",
"content": "I need to find every offline server alongside an online server in the same region."
},
{
"role": "assistant",
"content": "SELECT s_off.server_id AS offline_id,\n s_on.server_id AS online_id\nFROM gaming_technology.servers s_off\nJOIN gaming_technology.servers ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varyi... | [
{
"role": "user",
"content": "For hashtag ID 'H789', get each post ID and the number of distinct comments that have been made on those posts."
},
{
"role": "assistant",
"content": "SELECT ph.post_id,\n COUNT(DISTINCT c.comment_id) AS comment_count\nFROM social_media.post_hashtags ph\nJOIN ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.documents (
document_id character varying(64) NOT NULL, -- unique... | [
{
"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 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 trading_platform.wallets ( wallet_id text, user_id text, address text, private_key te... | [
{
"role": "user",
"content": "List the asset names and symbols for all assets of type 'token'."
},
{
"role": "assistant",
"content": "SELECT name, symbol FROM trading_platform.assets WHERE type = 'token';"
},
{
"role": "user",
"content": "Find all pairs of achievement unlocks and ite... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name characte... | [
{
"role": "user",
"content": "Find all law firms that share the same address, listing each address and the two firm names."
},
{
"role": "assistant",
"content": "SELECT f1.address, f1.firm_name AS firm1, f2.firm_name AS firm2 FROM law_firms f1 JOIN law_firms f2 ON f1.address = f2.address AND f1.... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, ... | [
{
"role": "user",
"content": "Show properties and the names of their room types."
},
{
"role": "assistant",
"content": "SELECT T1.property_name , T2.type_name FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room_types AS T2 ON T1.property_id = T2.property_id"
},
{... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifie... | [
{
"role": "user",
"content": "Show each contract address and the count of successful transactions sent to that contract."
},
{
"role": "assistant",
"content": "SELECT c.address, COUNT(t.transaction_id) AS success_tx_count FROM web3.contracts c JOIN web3.transactions t ON t.to_address = c.address... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.agencies ( agency_id text, agency_name text, jurisdiction_level t... | [
{
"role": "user",
"content": "List all employees with the job title 'Analyst'. Show their first name, last name, and department."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, department\nFROM government_services.employees\nWHERE job_title = 'Analyst';"
},
{
"role":... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdic... | [
{
"role": "user",
"content": "Count the number of active services provided by each agency. Return the agency_name and the count of active services for each."
},
{
"role": "assistant",
"content": "SELECT a.agency_name, COUNT(*) AS active_service_count\nFROM government_services.agencies AS a\nJOIN... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character... | [
{
"role": "user",
"content": "Show the names of all insurance plans and the number of patients enrolled in each plan."
},
{
"role": "assistant",
"content": "SELECT ip.plan_name, COUNT(pi.patient_id) AS enrolled_patients FROM healthcare.insurance_plans ip JOIN healthcare.patient_insurance pi ON i... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text... | [
{
"role": "user",
"content": "List all pairs of token transfers occurring within the same transaction where one transferred value is greater than the other, showing both transfer IDs, the transaction ID, and both values."
},
{
"role": "assistant",
"content": "SELECT t1.transaction_id,\n t1... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE gaming_technology.developers (
developer_id uuid NOT NULL DEFAULT gen_random_uuid... | [
{
"role": "user",
"content": "Show for each developer and inventory item combination the number of times that item appears in player inventories."
},
{
"role": "assistant",
"content": "SELECT d.developer_id, d.name AS developer_name, pi.item_id, COUNT(pi.inventory_id) AS inventory_count FROM gam... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin... | [
{
"role": "user",
"content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and the count of transactions they've been involved in, sorted by transaction count in descending order."
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.addre... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure
CREATE TABLE financial_services.trades ( trade_id character varying(64) NOT NULL, account_id chara... | [
{
"role": "user",
"content": "List each account number and the total quantity of shares traded through it."
},
{
"role": "assistant",
"content": "SELECT T2.account_number, SUM(T1.quantity) FROM financial_services.trades AS T1 JOIN financial_services.accounts AS T2 ON T1.account_id = T2.account_i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.