system
stringlengths
315
8.44k
conversations
listlengths
2
8
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_birt...
[ { "role": "user", "content": "Can you list all patients along with the insurance plan names they are enrolled in? Please include patient ID, first name, last name, and plan name.", "sql": null }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, ip.plan_name\...
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, fu...
[ { "role": "user", "content": "For all posts created between '2024-03-01' and '2024-03-31', show the post_id, content, and the author's full_name.", "sql": null }, { "role": "assistant", "content": "SELECT p.post_id, p.content, u.full_name\nFROM social_media.posts p\nJOIN social_media.users u...
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.customers ( customer_id text PRIMARY KEY, first_name text, last_n...
[ { "role": "user", "content": "List all trades with their order_id, trade_type, and commission for trades with commission higher than 100.", "sql": null }, { "role": "assistant", "content": "SELECT trade_id, order_id, trade_type, commission FROM financial_services.trades WHERE commission > 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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text,...
[ { "role": "user", "content": "Retrieve a list of agents who were hired in 2024. Include agent_id, first_name, last_name, hire_date.", "sql": null }, { "role": "assistant", "content": "SELECT agent_id, first_name, last_name, hire_date\nFROM insurance.agents\nWHERE hire_date >= '2024-01-01' AN...
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 PRIMARY KEY, claim_id text, document_ty...
[ { "role": "user", "content": "List all documents uploaded in the year 2024, showing document_id, file_name, and uploaded_at.", "sql": null }, { "role": "assistant", "content": "SELECT document_id, file_name, uploaded_at FROM insurance.claim_documents WHERE uploaded_at >= '2024-01-01' AND upl...
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, license_plate.text, vin.text, make.text, ...
[ { "role": "user", "content": "Provide the total number of vehicles for each fuel_type.", "sql": null }, { "role": "assistant", "content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type;", "sql": null }, { "role": "user", "conten...
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 appointment IDs and statuses for all appointments scheduled at locations in the city of 'San Francisco'.", "sql": null }, { "role": "assistant", "content": "SELECT a.appointment_id, a.status\nFROM government_services.appointments a\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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.t...
[ { "role": "user", "content": "For each user, show their user_id, KYC status, and the total count of completed orders they've placed.", "sql": null }, { "role": "assistant", "content": "SELECT k.user_id, k.status, COUNT(o.order_id) AS completed_order_count\nFROM trading_platform.kyc_audit k\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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birt...
[ { "role": "user", "content": "List all insurance plans and the number of patients associated with each plan.", "sql": null }, { "role": "assistant", "content": "SELECT ip.plan_name, COUNT(pi.patient_id) FROM healthcare.insurance_plans ip JOIN healthcare.patient_insurance pi ON ip.plan_id = p...
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 text PRIMARY KEY, policy_id text, customer_i...
[ { "role": "user", "content": "Count the number of completed premium payments grouped by payment_method.", "sql": null }, { "role": "assistant", "content": "SELECT payment_method,\n COUNT(*) AS payment_count\nFROM insurance.premium_payments\nWHERE status = 'Completed'\nGROUP BY payment_...
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 PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "Show me the count of items for each rarity, but only for items with a cost greater than 0.", "sql": null }, { "role": "assistant", "content": "SELECT\n rarity,\n COUNT(*) AS item_count\nFROM\n gaming_technology.in_game_items\nWHERE\n cost_amount IS NOT NULL ...
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, a...
[ { "role": "user", "content": "How many unread notifications does each user have?", "sql": null }, { "role": "assistant", "content": "SELECT user_id,\n COUNT(*) AS unread_notifications\nFROM trading_platform.notifications\nWHERE read_at IS NULL\nGROUP BY user_id;", "sql": null } ]
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.claims ( claim_id character varying(64) NOT NULL, -- unique identifier...
[ { "role": "user", "content": "Calculate the average number of days between when an incident occurred and when the claim was reported, but only for claims that were settled in the year 2023.", "sql": null }, { "role": "assistant", "content": "SELECT\n AVG(EXTRACT(EPOCH FROM (reported_date - ...
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.medications ( medication_id.text, medication_name.text, generic_name.text...
[ { "role": "user", "content": "Find all medications whose generic_name matches the medication_name of another entry, displaying the brand medication_id, brand medication_name, generic medication_id, and generic medication_name.", "sql": null }, { "role": "assistant", "content": "SELECT b.medi...
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": "Show me each product_type along with the count of products for that type, but only include types where the average base_premium exceeds 500. Order the results by the product count in descending order.", "sql": null }, { "role": "assistant", "content": "SELECT pr...
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.securities ( security_id text PRIMARY KEY, ticker_symbol text, is...
[ { "role": "user", "content": "List all securities (security_id, ticker_symbol, security_name) that have a currency of 'EUR' and were last updated within the last 30 days, along with their exchange and sector information.", "sql": null }, { "role": "assistant", "content": "SELECT security_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 gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFA...
[ { "role": "user", "content": "Which achievements have been unlocked by more than 100 unique players? Show the achievement ID and the count.", "sql": null }, { "role": "assistant", "content": "SELECT achievement_id, COUNT(DISTINCT player_id) AS player_count FROM gaming_technology.player_achie...
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, fu...
[ { "role": "user", "content": "Show me the usernames and email addresses of all users who have commented on posts that contain the hashtag 'music'.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT u.username, u.email\nFROM social_media.comments c\nJOIN social_media.posts p ...
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.customers ( customer_id character varying(64) NOT NULL, first_nam...
[ { "role": "user", "content": "I need a summary of total traded volume and average price per unit by sector using the trades and securities tables for trades in the last 30 days.", "sql": null }, { "role": "assistant", "content": "SELECT\n s.sector,\n SUM(t.quantity) AS total_volume,\n AVG...
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_birt...
[ { "role": "user", "content": "List each chronic active diagnosis along with the prescribed medication details, showing diagnosis_id, diagnosis_code, medication_id, dosage, and diagnosis_date.", "sql": null }, { "role": "assistant", "content": "SELECT d.diagnosis_id, d.diagnosis_code, p.medic...
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": "Show all invoices for a specific client ID, say 'client_101'. Include the invoice number, total amount, status, and the client's name.", "sql": null }, { "role": "assistant", "content": "SELECT i.invoice_number, i.total_amount, i.status, c.first_name, c.last_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 character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "Find all citizens who have both uploaded at least one document and made at least one payment. Show their citizen ID, full name, and contact email.", "sql": null }, { "role": "assistant", "content": "SELECT c.citizen_id, c.first_name || ' ' || c.last_name AS full...
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.text, post_id.text, user_id.text, parent_comment_...
[ { "role": "user", "content": "Show me the conversation ID and creation time for all conversations that are not group chats and have a recorded last message time.", "sql": null }, { "role": "assistant", "content": "SELECT conversation_id, created_at FROM social_media.conversations WHERE is_gr...
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.text, username.text, email.text, password_hash.text...
[ { "role": "user", "content": "Show the email address and the creation date for every user, ordered by their username alphabetically.", "sql": null }, { "role": "assistant", "content": "SELECT email, created_at FROM trading_platform.users ORDER BY username ASC;", "sql": null } ]
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, case_id text, lawyer_id text, date_work...
[ { "role": "user", "content": "List total billable hours and total amount per lawyer for July 2023.", "sql": null }, { "role": "assistant", "content": "SELECT lawyer_id,\n SUM(hours_spent) AS total_hours,\n SUM(hours_spent * billing_rate) AS total_amount\nFROM legal_services.time_...
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 PRIMARY KEY, player_id uuid, game_...
[ { "role": "user", "content": "Show the game ID and the average session duration in minutes for each game, ordered by average session duration descending.", "sql": null }, { "role": "assistant", "content": "SELECT game_id, AVG(duration_seconds) / 60.0 AS avg_duration_minutes\nFROM gaming_tech...
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, fu...
[ { "role": "user", "content": "Show me all comments that are replies (i.e., have a parent_comment_id) on posts that include media, along with the comment content and creation time.", "sql": null }, { "role": "assistant", "content": "SELECT c.comment_id, c.parent_comment_id, c.content, c.creat...
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_i...
[ { "role": "user", "content": "How many appointments are scheduled at each location?", "sql": null }, { "role": "assistant", "content": "SELECT location_id, COUNT(*) AS scheduled_count FROM healthcare.appointments WHERE status = 'scheduled' GROUP BY location_id;", "sql": null } ]
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_i...
[ { "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.", "sql": null }, { "role": "assistant", "content": "SELECT property_id, COUNT(*) FROM reservations WHERE actual_check_...
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.guests ( guest_id character varying(64) NOT NULL, first_name ...
[ { "role": "user", "content": "List all guests who have communication consent enabled along with their email addresses.", "sql": null }, { "role": "assistant", "content": "SELECT guest_id,\n first_name || ' ' || last_name AS full_name,\n email\nFROM guests\nWHERE communication_con...
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 character varying(64) NOT NULL, -- uni...
[ { "role": "user", "content": "Show me all maintenance logs for 'Oil Change' services performed in the last 6 months, including the vehicle ID, service date, and cost.", "sql": null }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_log...
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.service_locations ( location_id text, agency_id text, location_n...
[ { "role": "user", "content": "How many service locations are there for each agency? List the agency ID and the count of locations.", "sql": null }, { "role": "assistant", "content": "SELECT agency_id , count(*) FROM government_services.service_locations GROUP BY 1", "sql": null } ]
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 ...
[ { "role": "user", "content": "Show me the total number of appointments grouped by status.", "sql": null }, { "role": "assistant", "content": "SELECT status,\n COUNT(*) AS appointment_count\nFROM legal_services.appointments\nGROUP BY status;", "sql": null }, { "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 healthcare.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_pro...
[ { "role": "user", "content": "Find all insurance providers that offer both HMO and PPO plans and list the provider name along with the corresponding HMO and PPO plan IDs.", "sql": null }, { "role": "assistant", "content": "SELECT h.insurance_provider,\n h.plan_id AS hmo_plan_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 // PUT /schedules { "mappings": { "properties": { "schedule_id": { "type": "keyword" ...
[ { "role": "user", "content": "能否帮我统计数据库中所有乘客的数量,按忠诚计划ID分组?", "sql": null }, { "role": "assistant", "content": "SELECT loyalty_program_id, COUNT(*) as passenger_count\nFROM passengers\nGROUP BY loyalty_program_id;", "sql": null } ]
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 characte...
[ { "role": "user", "content": "Which patients have a primary insurance policy and are subscribed to a plan provided by 'Cigna'? List patient ID, full name, policy number, plan ID, and insurance provider.", "sql": null }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p....
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_i...
[ { "role": "user", "content": "For each service location in Texas, provide the location name, city, and the number of appointments scheduled there by verified citizens.", "sql": null }, { "role": "assistant", "content": "SELECT sl.location_name, sl.city, COUNT(a.appointment_id) AS appointment...
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.employees ( employee_id character varying(64) NOT NULL, first_nam...
[ { "role": "user", "content": "Show me the full names and job titles of all employees along with their managers’ full names in the same result.", "sql": null }, { "role": "assistant", "content": "SELECT e.employee_id, e.first_name || ' ' || e.last_name AS employee_name, e.job_title, m.first_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 gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.t...
[ { "role": "user", "content": "Show me all servers in the same region that have different statuses. I want to see the server names, regions, and their statuses for each pair.", "sql": null }, { "role": "assistant", "content": "SELECT s1.server_name AS server1, s2.server_name AS server2, s1.re...
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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id te...
[ { "role": "user", "content": "List all beneficiaries who do not have any contact information provided. Show beneficiary_id, first_name, and last_name.", "sql": null }, { "role": "assistant", "content": "SELECT beneficiary_id, first_name, last_name FROM insurance.policy_beneficiaries WHERE 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 social_media.messages ( message_id character varying(64) NOT NULL, conversation_id c...
[ { "role": "user", "content": "What is the total number of messages sent with a media URL?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.messages WHERE media_url IS NOT NULL;", "sql": null } ]
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, product_na...
[ { "role": "user", "content": "List the product_name and description for all active products.", "sql": null }, { "role": "assistant", "content": "SELECT product_name, description FROM insurance.insurance_products WHERE is_active = true;", "sql": null }, { "role": "user", "cont...
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.text, policy_id.text, customer_id.text, paym...
[ { "role": "user", "content": "Show me all premium payments made via credit card in the last 30 days, along with their payment amounts and transaction references.", "sql": null }, { "role": "assistant", "content": "SELECT payment_id, amount_paid, transaction_reference FROM insurance.premium_p...
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 identifi...
[ { "role": "user", "content": "List all users and the total value of all transactions they have initiated. Show user_id, username, and total_transaction_value.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COALESCE(SUM(t.value), 0) AS total_transaction_valu...
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_birt...
[ { "role": "user", "content": "List all patients who have both primary and non-primary insurance plans, showing their full names and the count of each type of plan.", "sql": null }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, SUM(CASE WHEN pi.is_primary = true THEN 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 CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_nam...
[ { "role": "user", "content": "Find all pairs of drivers who have the same license expiry date. For each pair, provide both driver_ids, full names, and the shared expiry date.", "sql": null }, { "role": "assistant", "content": "SELECT d1.driver_id AS driver1_id, d1.first_name || ' ' || d1.las...
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.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agenc...
[ { "role": "user", "content": "Find all agents with their managers where the agent's commission rate is above 0.10.", "sql": null }, { "role": "assistant", "content": "SELECT a.agent_id,\n a.first_name || ' ' || a.last_name AS agent_name,\n m.agent_id AS manager_id,\n m.firs...
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.transactions ( transaction_id character varying(64) NOT NULL, -- uni...
[ { "role": "user", "content": "List all transactions with an amount greater than 10000, showing transaction_id, block_id, sender_address, receiver_address, and amount.", "sql": null }, { "role": "assistant", "content": "SELECT transaction_id, block_id, sender_address, receiver_address, amount...
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.diagnoses ( diagnosis_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "List the patient ID and subscriber name for all patients who have both at least one diagnosis recorded and at least one primary insurance policy.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT pi.patient_id, pi.subscriber_name FROM healthcar...
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 PRIMARY KEY, user_id text, address text, p...
[ { "role": "user", "content": "Show each user ID with the date of their first created wallet.", "sql": null }, { "role": "assistant", "content": "SELECT user_id, MIN(created_at) AS first_wallet_date\nFROM trading_platform.wallets\nGROUP BY user_id;", "sql": null } ]
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_...
[ { "role": "user", "content": "Show the service names that had documents uploaded for their applications in the calendar year 2023.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT T1.service_name FROM government_services.services AS T1 JOIN applications AS T2 ON T1.service...
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.medications ( medication_id character varying(64) NOT NULL, -- unique...
[ { "role": "user", "content": "Count the total number of medications that have a description longer than 100 characters.", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM healthcare.medications WHERE description IS NOT NULL AND LENGTH(description) > 100;", "sql": nu...
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, token_id characte...
[ { "role": "user", "content": "Find all addresses that have both received and sent transfers of the same token. List the address and the token ID for each such instance.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT t1.to_address AS address, t1.token_id FROM web3.token_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 social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url...
[ { "role": "user", "content": "Find posts created in the last 60 days that have received at least one like. Show the post ID, its creation time, and the total number of likes for each such post.", "sql": null }, { "role": "assistant", "content": "SELECT p.post_id, p.created_at, COUNT(l.like_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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text...
[ { "role": "user", "content": "For each user, show their username and the number of unique IP addresses from the peers table where the port is less than 2000.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, COUNT(DISTINCT p.ip_address) AS unique_ip_count\nFROM trading_p...
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.medications ( medication_id character varying(64) NOT NULL, medication_na...
[ { "role": "user", "content": "Show me the names and manufacturers of all medications that have a description provided.", "sql": null }, { "role": "assistant", "content": "SELECT medication_name, manufacturer FROM healthcare.medications WHERE description IS NOT NULL;", "sql": null }, ...
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, produ...
[ { "role": "user", "content": "List all insurance products along with their product types and the date they were last updated, but only include products where the base premium is greater than 2000.", "sql": null }, { "role": "assistant", "content": "SELECT product_id, product_name, product_ty...
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 ...
[ { "role": "user", "content": "For each asset, list its ID and the total number of trades and the total traded value (quantity * price).", "sql": null }, { "role": "assistant", "content": "SELECT a.asset_id,\n COALESCE(t.trade_count, 0) AS trade_count,\n COALESCE(t.total_value, 0)...
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, property_name text, address_li...
[ { "role": "user", "content": "For each property, list the property name and the count of payments processed.", "sql": null }, { "role": "assistant", "content": "SELECT\n prop.property_name,\n COUNT(p.payment_id) AS payment_count\nFROM hospitality_technology.properties AS prop\nJOIN hospita...
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, jurisdi...
[ { "role": "user", "content": "List the name of each agency and the total number of service locations it operates in New York State.", "sql": null }, { "role": "assistant", "content": "SELECT a.agency_name, COUNT(sl.location_id) AS location_count\nFROM government_services.agencies a\nLEFT 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 social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name characte...
[ { "role": "user", "content": "I need all pairs of hashtags that start with the same first two letters. Show both tag names.", "sql": null }, { "role": "assistant", "content": "SELECT h1.tag_name AS tag1, h2.tag_name AS tag2\nFROM social_media.hashtags h1\nJOIN social_media.hashtags h2\n ON ...
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.customers ( customer_id text PRIMARY KEY, first_name text, last_n...
[ { "role": "user", "content": "Which securities have had the largest maximum single-day trading volume in the market_data table? Show me the ticker symbol, security name, and that maximum volume.", "sql": null }, { "role": "assistant", "content": "SELECT s.ticker_symbol, s.security_name, MAX(...
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, license_plate text, vin text, make text, ...
[ { "role": "user", "content": "Show each vehicle's ID along with another vehicle's ID where they share the same make but have different models. Sort by the first vehicle_id.", "sql": null }, { "role": "assistant", "content": "SELECT v1.vehicle_id AS vehicle_a, v2.vehicle_id AS vehicle_b\nFROM...
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 character varying(64) NOT NULL, first_name character ...
[ { "role": "user", "content": "I need a list of patients' policy numbers along with their insurance plan names and the plan's website. Return patient_id, policy_number, plan_name, and website.", "sql": null }, { "role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, ip.plan_...
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.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.ti...
[ { "role": "user", "content": "Show me all claims handled by agent 'AG123' along with their settlement details.", "sql": null }, { "role": "assistant", "content": "SELECT claim_id, policy_id, customer_id, settlement_amount, settlement_date FROM insurance.claims WHERE claim_handler_id = 'AG123...
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 Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe...
[ { "role": "user", "content": "I need to find all components associated with a specific supplier. Can you help with that?", "sql": null }, { "role": "assistant", "content": "HGETALL component:<component_id>\nIF HGET component:<component_id> supplier_id = 'sup:ACME_AERO' THEN INCLUDE", "sq...
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.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id charac...
[ { "role": "user", "content": "Show each patient's policy number, the associated insurance plan ID, and any medications they have been prescribed, including the medication ID and prescription date.", "sql": null }, { "role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi....
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.securities ( security_id text, ticker_symbol text, isin_code text...
[ { "role": "user", "content": "Can you list all securities that have had at least one trade in the past 30 days? Please include the ticker_symbol, security_name, exchange, and the total number of trades for each security.", "sql": null }, { "role": "assistant", "content": "SELECT s.ticker_sym...
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 varyi...
[ { "role": "user", "content": "Show me all posts created between '2024-06-01' and '2024-06-30', showing post_id, content, and media_type.", "sql": null }, { "role": "assistant", "content": "SELECT post_id, content, media_type FROM social_media.posts WHERE created_at >= '2024-06-01' AND create...
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 character varying(100) NOT NULL, -- the id of the token t...
[ { "role": "user", "content": "Show me the top 3 narratives by trend rank, along with their top 3 tokens and 7-day price change percentage.", "sql": null }, { "role": "assistant", "content": "SELECT n.narrative, n.top_3_coins, n.price_change_percentage_7d FROM narrative_info n ORDER BY n.tren...
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 character varying(64) NOT NULL, post_id...
[ { "role": "user", "content": "How many users currently have their profile set to private?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.user_settings WHERE private_profile = true;", "sql": null } ]
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.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.t...
[ { "role": "user", "content": "Retrieve all patient insurance entries that have an expiration date before January 1st, 2024. Display the policy number, expiration date, and subscriber name.", "sql": null }, { "role": "assistant", "content": "SELECT policy_number, expiration_date, subscriber_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 transportation.locations ( location_id.text, name.text, type.text, address_line1.tex...
[ { "role": "user", "content": "Show me the name and type for all the locations.", "sql": null }, { "role": "assistant", "content": "SELECT name, type FROM transportation.locations", "sql": null }, { "role": "user", "content": "Now, filter this list to only include locations wh...
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, fil...
[ { "role": "user", "content": "Show me all details for documents associated with claim ID 'CLM98765'.", "sql": null }, { "role": "assistant", "content": "SELECT * FROM insurance.claim_documents WHERE claim_id = 'CLM98765';", "sql": null }, { "role": "user", "content": "From th...
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.customers ( customer_id.text, first_name.text, last_name.text, da...
[ { "role": "user", "content": "For each city, list the number of unique customer last names, and show the city and this count.", "sql": null }, { "role": "assistant", "content": "SELECT city, COUNT(DISTINCT last_name) AS unique_last_name_count FROM financial_services.customers GROUP BY city;"...
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 character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "List each law firm name and the count of clients whose company_name matches that firm.", "sql": null }, { "role": "assistant", "content": "SELECT f.firm_id, f.firm_name, COUNT(c.client_id) AS client_count\nFROM legal_services.law_firms AS f\nLEFT JOIN legal_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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "Show me the usernames and full names of all users who have liked at least one post that was created in May 2024.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT u.username, u.full_name\nFROM social_media.users u\nJOIN social_media.likes l ON ...
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.passengers ( passenger_id text, first_name text, last_name text, emai...
[ { "role": "user", "content": "List pairs of passengers where one registered before another, including both their first names, created_at timestamps, and loyalty_program_id.", "sql": null }, { "role": "assistant", "content": "SELECT p1.first_name AS earlier,\n p2.first_name AS later,\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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "Show the first name, last name, and position of all staff members who are not currently active.", "sql": null }, { "role": "assistant", "content": "SELECT first_name , last_name , position FROM hospitality_technology.staff WHERE is_active = false", "sql"...
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 character varying(64) NOT NULL, user_id character...
[ { "role": "user", "content": "List all orders that are currently pending and were created more than 24 hours ago.", "sql": null }, { "role": "assistant", "content": "SELECT * FROM trading_platform.orders WHERE status = 'pending' AND created_at < CURRENT_TIMESTAMP - INTERVAL '24 hours';", ...
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 erc20_balances_historical ( block_number bigint, contract_address varchar, wallet_ad...
[ { "role": "user", "content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address.", "sql": null }, { "role": "assistant", "content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE contract_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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name characte...
[ { "role": "user", "content": "Count how many doctors have an email address ending with '.com'.", "sql": null }, { "role": "assistant", "content": "SELECT count(*) FROM healthcare.doctors WHERE email LIKE '%.com';", "sql": null } ]
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_time...
[ { "role": "user", "content": "Identify all instances where a vehicle's odometer_reading decreased compared to its previous fuel log entry.", "sql": null }, { "role": "assistant", "content": "SELECT curr.vehicle_id,\n prev.fuel_log_id AS previous_log_id,\n prev.odometer_reading ...
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, agency_i...
[ { "role": "user", "content": "How many employees were hired in each year?", "sql": null }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM hire_date) AS hire_year , COUNT(*) AS employee_count FROM employees GROUP BY hire_year", "sql": null }, { "role": "user", "c...
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 ...
[ { "role": "user", "content": "Show the first and last name of each citizen and the count of their scheduled appointments.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(a.appointment_id) AS scheduled_appointment_count FROM government_services.citi...
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": "List each property with its manager's full name and the count of currently available services it offers.", "sql": null }, { "role": "assistant", "content": "SELECT p.property_id,\n p.property_name,\n CONCAT(m.first_name, ' ', m.last_name) AS manager_...
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, -- unique ide...
[ { "role": "user", "content": "Show me all claims along with the related customer's full name and the policy number for incidents that occurred in 2024.", "sql": null }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, c.description, cu.first_name || ' ' || cu.last_name ...
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, patient_id text, doctor_id text, appo...
[ { "role": "user", "content": "List the names of all insurance providers who offer at least one plan of type 'EPO'.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT insurance_provider\nFROM healthcare.insurance_plans\nWHERE plan_type = 'EPO';", "sql": null } ]
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 PRIMARY KEY, first_name text, last_name text, ...
[ { "role": "user", "content": "Show me all patients who have received at least two different medications prescribed by doctors working at the same hospital. Include the patient full name, the medication names, and the shared hospital_affiliation_id.", "sql": null }, { "role": "assistant", "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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text,...
[ { "role": "user", "content": "For each ERC20 token, show the contract address, symbol, and the total number of unique wallet holders based on the current erc20_balances table.", "sql": null }, { "role": "assistant", "content": "SELECT e.contract_address, t.symbol, COUNT(DISTINCT e.wallet_add...
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.trades ( trade_id character varying(64) NOT NULL, order_id characte...
[ { "role": "user", "content": "List all trades that occurred on July 10, 2024, showing the trade ID, asset symbol, quantity, and trade price.", "sql": null }, { "role": "assistant", "content": "SELECT t.trade_id, a.symbol AS asset_symbol, t.quantity, t.price\nFROM trading_platform.trades t\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 financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_n...
[ { "role": "user", "content": "Show me the average daily price range (high minus low) and the total count of data points for each security type, based on the market data available.", "sql": null }, { "role": "assistant", "content": "SELECT s.security_type, AVG(md.high_price - md.low_price) 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 social_media.follows ( follow_id.text, follower_user_id.text, following_user_id.text...
[ { "role": "user", "content": "How many users have followed more than one person in total?", "sql": null }, { "role": "assistant", "content": "SELECT follower_user_id, COUNT(DISTINCT following_user_id) AS following_count\nFROM social_media.follows\nGROUP BY follower_user_id\nHAVING COUNT(DIST...
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.customers ( customer_id text PRIMARY KEY, first_name text, last_n...
[ { "role": "user", "content": "Show me a summary of customers with their total account balance and the count of accounts.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(a.account_id) AS account_count, SUM(a.balance) AS total_account_balance FROM fi...
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 ...
[ { "role": "user", "content": "I want each user with the date and action of their most recent log entry, along with how many log entries they have in the last 7 days.", "sql": null }, { "role": "assistant", "content": "WITH recent_logs AS (\n SELECT user_id, action, logged_at,\n ROW_...
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 narrative_info ( narrative character varying(512) NOT NULL, -- the id of narrative t...
[ { "role": "user", "content": "Show me the top 5 narratives by market cap, along with their top 3 coins and 24-hour trading volume.", "sql": null }, { "role": "assistant", "content": "SELECT narrative, top_3_coins, volume_24h FROM narrative_info ORDER BY market_cap DESC LIMIT 5;", "sql": ...
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 are the maintenance costs for a specific aircraft model like the Airbus A320?", "sql": null }, { "role": "assistant", "content": "I'm sorry, but I don't have access to data regarding maintenance costs for specific aircraft models such as the Airbus A320. Th...
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.messages ( message_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "List the content and sent time for messages sent by user 'U101'.", "sql": null }, { "role": "assistant", "content": "SELECT content, sent_at FROM social_media.messages WHERE sender_user_id = 'U101';", "sql": null }, { "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.locations ( location_id text PRIMARY KEY, name text, type text, addre...
[ { "role": "user", "content": "What is the average cost per unit for fuel at each location type? Show the location type and the average cost.", "sql": null }, { "role": "assistant", "content": "SELECT T2.type , AVG(T1.cost_per_unit) FROM transportation.fuel_logs AS T1 JOIN transportation.loc...
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 character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "List all policies sold by agents licensed in 'CA', showing the policy number, start date, and the agent's first and last name.", "sql": null }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.start_date, T2.first_name, T2.last_name FROM insurance....