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": "I need to find patients who received prescriptions within 7 days after their latest appointment. Show patient_id, first and last name, appointment_time, prescription_date, and medication_name.", "sql": null }, { "role": "assistant", "content": "WITH latest_appt ...
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": "Provide for each game_id the count of hidden and visible achievements.", "sql": null }, { "role": "assistant", "content": "SELECT game_id,\n SUM(CASE WHEN hidden THEN 1 ELSE 0 END) AS hidden_count,\n SUM(CASE WHEN hidden = false THEN 1 ELSE 0 END) 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.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "For each game, find the hidden achievement with the highest points and show the game title, achievement name, and points.", "sql": null }, { "role": "assistant", "content": "SELECT g.title AS game_title,\n a.name AS achievement_name,\n a.points\nFRO...
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, prop...
[ { "role": "user", "content": "Get the full name of guests, the property name, check-in and check-out dates, and total amount for all reservations with more than 2 adults.", "sql": null }, { "role": "assistant", "content": "SELECT g.first_name || ' ' || g.last_name AS guest_full_name, p.prope...
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, customer_id.text, product_id.text, agent_id.tex...
[ { "role": "user", "content": "List active policies where the premium amount is greater than the base premium of the linked insurance product. Show policy number, policy premium, product name, and product base premium.", "sql": null }, { "role": "assistant", "content": "SELECT T1.policy_numbe...
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.text, user_id.text, post_id.text, comment_id.text, crea...
[ { "role": "user", "content": "Retrieve pairs of likes where the same user liked two different posts. For each pair, show user_id, p1.post_id AS first_post_id, p2.post_id AS second_post_id, and the time difference in minutes between the two likes.", "sql": null }, { "role": "assistant", "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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_nam...
[ { "role": "user", "content": "What is the total investment_value per fundraising round for the year 2023? Order by total investment descending.", "sql": null }, { "role": "assistant", "content": "SELECT\n substr(investment_date,1,7) AS month,\n rounds_name,\n SUM(investment_value) AS tota...
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, first_name text, last_name text, company_na...
[ { "role": "user", "content": "How many documents of each type exist in the system? Show the document type and the count.", "sql": null }, { "role": "assistant", "content": "SELECT document_type, COUNT(*) AS document_count\nFROM legal_services.documents\ngroup BY document_type;", "sql": 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.claims ( claim_id character varying(64) NOT NULL, policy_id character vary...
[ { "role": "user", "content": "List all claim IDs, policy IDs, and incident dates for claims reported after February 1st, 2024.", "sql": null }, { "role": "assistant", "content": "SELECT claim_id, policy_id, incident_date\nFROM insurance.claims\nWHERE reported_date > '2024-02-01';", "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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text,...
[ { "role": "user", "content": "Find the citizen_id, full name, contact_email, and the number of notifications each citizen has received in the last 7 days. Only include citizens who have received at least 3 notifications.", "sql": null }, { "role": "assistant", "content": "SELECT c.citizen_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.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name...
[ { "role": "user", "content": "Show me, for each game, the achievement that has been unlocked by the most players. Include the game title, achievement name, and the number of players who unlocked it.", "sql": null }, { "role": "assistant", "content": "WITH RankedAchievements AS ( SELECT pa.ac...
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.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id....
[ { "role": "user", "content": "List each game along with the title and release_date of the next game released by the same developer.", "sql": null }, { "role": "assistant", "content": "SELECT g1.game_id AS original_game_id,\n g1.title AS original_title,\n g2.game_id AS next_game_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.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_i...
[ { "role": "user", "content": "I want to list the appointment_id, patient_id, appointment_time, and plan_name for all appointments where the status is 'scheduled'. Show me which insurance plans apply.", "sql": null }, { "role": "assistant", "content": "SELECT a.appointment_id, a.patient_id, 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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text...
[ { "role": "user", "content": "Retrieve the guest and property pairs where the guest lives in the same state as the property. Show guest_id, first_name, last_name, property_id, property_name.", "sql": null }, { "role": "assistant", "content": "SELECT g.guest_id,\n g.first_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 legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number...
[ { "role": "user", "content": "Show me each lawyer along with the names of documents they have uploaded.", "sql": null }, { "role": "assistant", "content": "SELECT l.first_name || ' ' || l.last_name AS lawyer_name,\n d.document_name\nFROM legal_services.lawyers l\nLEFT JOIN legal_servic...
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 text, address text, abi text, bytecode text, deployer_a...
[ { "role": "user", "content": "Show all tokens along with the username of the deployer of the contract where each token was created. Include the token symbol, token name, contract address, and username.", "sql": null }, { "role": "assistant", "content": "SELECT t.token_symbol, t.token_name, 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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text,...
[ { "role": "user", "content": "List all addresses (address_line1, city, state) where more than one customer resides, and show how many customers share each address.", "sql": null }, { "role": "assistant", "content": "SELECT address_line1,\n city,\n state,\n COUNT(*) AS resid...
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.assets ( asset_id character varying(64) NOT NULL, name character va...
[ { "role": "user", "content": "List all addresses from the utxos table that have at least one spent UTXO and at least one unspent UTXO.", "sql": null }, { "role": "assistant", "content": "SELECT address FROM trading_platform.utxos GROUP BY address HAVING MIN(spent::int) = 0 AND MAX(spent::int...
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": "List the usernames and email addresses of users who have participated in group chats, along with the names of those group chats.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, u.email, c.group_name\nFROM social_media.users u\nJOIN social_...
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 character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "Provide a list of all drivers and for each, show their driver_id, full name, the total number of completed trips they've driven, and the sum of all fares from bookings on those completed trips. Include drivers even if they have no completed trips. Order by total_fares descendin...
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....
[ { "role": "user", "content": "Find the names and addresses of service locations where no appointments have been scheduled.", "sql": null }, { "role": "assistant", "content": "SELECT sl.location_name, sl.address FROM government_services.service_locations sl LEFT JOIN government_services.appoi...
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": "Count applications per service category.", "sql": null }, { "role": "assistant", "content": "SELECT T2.category, COUNT(T1.application_id) FROM government_services.applications AS T1 JOIN government_services.services AS T2 ON T1.service_id = T2.service_id GROUP B...
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 iden...
[ { "role": "user", "content": "List all users whose usernames start with the letter 'B'.", "sql": null }, { "role": "assistant", "content": "SELECT user_id, username, email, created_at FROM trading_platform.users WHERE username LIKE 'B%';", "sql": null }, { "role": "user", "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 hospitality_technology.properties ( property_id text, property_name text, address_li...
[ { "role": "user", "content": "For each room, list the room number, property name, and the type name of the room.", "sql": null }, { "role": "assistant", "content": "SELECT r.room_number, p.property_name, rt.type_name\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.propertie...
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 pairs of policies for the same customer that have the same premium amount but different coverage limits. Show customer ID, policy ID 1, policy ID 2, the premium amount, and the two coverage limits.", "sql": null }, { "role": "assistant", "content": "SELECT ...
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_nam...
[ { "role": "user", "content": "Which narrative from narrative_info has the highest token_num, and what is the total market cap and 24h volume for that narrative?", "sql": null }, { "role": "assistant", "content": "SELECT narrative, market_cap, volume_24h, token_num\nFROM narrative_info\nORDER...
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.cases ( case_id text, case_number text, case_name text, client_id tex...
[ { "role": "user", "content": "List the number of cases for each case type that are currently marked as 'Open'.", "sql": null }, { "role": "assistant", "content": "SELECT case_type, COUNT(*) FROM legal_services.cases WHERE status = 'Open' GROUP BY case_type;", "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 gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, p...
[ { "role": "user", "content": "Can you list all item names and their types from the in-game items table?", "sql": null }, { "role": "assistant", "content": "SELECT item_name, item_type FROM gaming_technology.in_game_items;", "sql": null }, { "role": "user", "content": "Please ...
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": "For each chain, which token has the lowest average cost as reported by smart money, and what is its current price and ROI?", "sql": null }, { "role": "assistant", "content": "SELECT smtp.chain, smtp.token_symbol, MIN(smtp.avg_cost) AS lowest_avg_cost, smtp.price...
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, user_id.text, content.text, media_url.text, media...
[ { "role": "user", "content": "List each user along with how many image-type posts they've made, showing user_id and image_post_count, sorted by the count descending.", "sql": null }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS image_post_count\nFROM social_media.posts\nWHE...
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": "Retrieve all comments that are replies on posts with media attachments. Include comment_id, content, post media_url, and the commenter's username.", "sql": null }, { "role": "assistant", "content": "SELECT c.comment_id,\n c.content AS comment_content,\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.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_a...
[ { "role": "user", "content": "How many tokens are there for each number of decimals?", "sql": null }, { "role": "assistant", "content": "SELECT decimals, COUNT(*) FROM web3.tokens GROUP BY decimals;", "sql": null }, { "role": "user", "content": "Now, only show the decimal cou...
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 total number of completed orders they have placed, along with the name of the asset for each order.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, a.name AS asset_name, COUNT(o.order_id) AS compl...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch...
[ { "role": "user", "content": "Retrieve all active SUI coins with their owner, balance, symbol, and name.", "sql": null }, { "role": "assistant", "content": "SELECT sc.owner, sc.coin_type, sc.balance, scm.symbol, scm.name\nFROM sui_coins sc\nJOIN sui_coins_metadata scm ON sc.coin_type = scm.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 trading_platform.users ( user_id character varying(64) NOT NULL, username character ...
[ { "role": "user", "content": "For each peer port, count how many peers have used that port.", "sql": null }, { "role": "assistant", "content": "SELECT port,\n COUNT(*) AS peer_count\nFROM trading_platform.peers\nGROUP BY port;", "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.clients ( client_id character varying(64) NOT NULL, first_name charac...
[ { "role": "user", "content": "Show all cases with at least one billed and billable time entry, including case number, case name, total billed amount, and billed hours.", "sql": null }, { "role": "assistant", "content": "SELECT cs.case_number, cs.case_name, SUM(te.hours_spent * te.billing_rat...
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": "Provide a breakdown of the total number of applications submitted for each service category.", "sql": null }, { "role": "assistant", "content": "SELECT T2.category, count(T1.application_id) FROM applications AS T1 JOIN services AS T2 ON T1.service_id = T2.servic...
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, first_name text, last_name text, specialty text...
[ { "role": "user", "content": "List the names and contact phone numbers of all insurance plans whose website is not null.", "sql": null }, { "role": "assistant", "content": "SELECT plan_name, contact_phone\nFROM healthcare.insurance_plans\nWHERE website 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 web3.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(6...
[ { "role": "user", "content": "Can you show me all wallet address pairs that are owned by the same user but have different private keys, along with their wallet_ids and user_id?", "sql": null }, { "role": "assistant", "content": "SELECT w1.user_id, w1.wallet_id AS wallet_id_1, w1.address AS 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 gaming_technology.achievements ( achievement_id uuid NOT NULL DEFAULT gen_random...
[ { "role": "user", "content": "Show me the count of achievements that are hidden versus those that are not hidden.", "sql": null }, { "role": "assistant", "content": "SELECT hidden, COUNT(*) FROM achievements GROUP BY hidden;", "sql": null }, { "role": "user", "content": "Incl...
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": "Please show the names and bar numbers of all lawyers who have led appointments with more than 3 different clients.", "sql": null }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, l.bar_number\nFROM legal_services.lawyers l\nJOIN legal_servi...
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 PRIMARY KEY, invoice_number text UNIQUE, c...
[ { "role": "user", "content": "Show me pairs of invoice numbers for the same case.", "sql": null }, { "role": "assistant", "content": "SELECT T1.invoice_number, T2.invoice_number, T1.case_id FROM legal_services.invoices AS T1 JOIN legal_services.invoices AS T2 ON T1.case_id = T2.case_id AND 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 government_services.employees ( employee_id character varying(64) NOT NULL, -- u...
[ { "role": "user", "content": "Which department has the highest number of employees currently employed?", "sql": null }, { "role": "assistant", "content": "SELECT department FROM government_services.employees WHERE termination_date IS NULL GROUP BY department ORDER BY COUNT(*) DESC LIMIT 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 social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media...
[ { "role": "user", "content": "List all group chat conversations and the number of messages in each group chat.", "sql": null }, { "role": "assistant", "content": "SELECT c.conversation_id,\n c.group_name,\n COUNT(m.message_id) AS message_count\nFROM social_media.conversations c\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.conversations ( conversation_id.text, created_at.timestamp, last_messag...
[ { "role": "user", "content": "Get the count of unread 'message' notifications per group chat, showing conversation_id, group_name, and unread_message_notifications.", "sql": null }, { "role": "assistant", "content": "SELECT c.conversation_id,\n c.group_name,\n COUNT(n.notificatio...
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, -- u...
[ { "role": "user", "content": "List the first name and last name of each employee, along with the first and last name of their manager.", "sql": null }, { "role": "assistant", "content": "SELECT e.first_name AS employee_first_name, e.last_name AS employee_last_name, m.first_name AS manager_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.text, username.text, email.text, password_hash.text...
[ { "role": "user", "content": "List all unique actions that have been logged in the system.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT action FROM trading_platform.logs;", "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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id te...
[ { "role": "user", "content": "List the first name, last name, and relationship for all beneficiaries whose percentage share is between 10 and 50, inclusive.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, relationship FROM insurance.policy_beneficiaries WHER...
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.loans ( loan_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "For each account opening year, I'd like the total principal amount of loans and the count of loans. Please join loans with accounts.", "sql": null }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM a.created_at) AS open_year,\n SUM(l.principal_...
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.accounts ( account_id.text, customer_id.text, account_number.text...
[ { "role": "user", "content": "Summarize the total balance and average interest rate for each account type.", "sql": null }, { "role": "assistant", "content": "SELECT account_type, SUM(balance) AS total_balance, AVG(interest_rate) AS average_interest_rate FROM financial_services.accounts GROU...
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": "For each transaction status, what is the average transaction value?", "sql": null }, { "role": "assistant", "content": "SELECT status, AVG(value) FROM web3.transactions GROUP BY status", "sql": null }, { "role": "user", "content": "Could you filt...
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 Index 'suppliers'. Mapping: { properties: { supplier_id: { type: 'keyword' }, supplier_name: { ty...
[ { "role": "user", "content": "특정 공급업체 ID로 공급업체의 세부 정보를 조회하고 싶습니다. 모든 필드를 포함해 주세요.", "sql": null }, { "role": "assistant", "content": "GET suppliers/_doc/{supplier_id}", "sql": null }, { "role": "user", "content": "만약 여러 공급업체 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t...
[ { "role": "user", "content": "List all ERC20 tokens where the total supply is between '1000000000' and '5000000000'. Show the symbol and name.", "sql": null }, { "role": "assistant", "content": "SELECT symbol, name FROM token_metas WHERE is_erc20 = 1 AND total_supply >= '1000000000' AND tota...
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": "Which clients have not had any appointments scheduled? Please list their first name, last name, and email.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, c.email\nFROM legal_services.clients c\nLEFT JOIN legal_services.appo...
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_l...
[ { "role": "user", "content": "List all trips for routes of type 'Express', showing the trip ID and route number.", "sql": null }, { "role": "assistant", "content": "SELECT T.trip_id, R.route_number FROM transportation.trips AS T JOIN transportation.routes AS R ON T.route_id = R.route_id WHER...
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 NOT NULL, -- Block number contai...
[ { "role": "user", "content": "For each Avalanche token tick, find its total transfer volume and transfer count in the last 7 days.", "sql": null }, { "role": "assistant", "content": "SELECT\n a.tick,\n SUM(a.amt) AS total_volume,\n COUNT(*) AS transfer_count\nFROM token_activities_avalanc...
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 character varying(64) NOT NU...
[ { "role": "user", "content": "List the full name of patients whose primary insurance plan is provided by 'BlueCross BlueShield', along with the plan name.", "sql": null }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T3.plan_name FROM healthcare.patients AS T1 JOIN ...
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 text, firm_name text, address text, phone text, w...
[ { "role": "user", "content": "What is the total sum of amounts paid for all invoices?", "sql": null }, { "role": "assistant", "content": "SELECT SUM(amount_paid) FROM invoices;", "sql": null }, { "role": "user", "content": "Group this total by the status of the invoice.", ...
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": "Count the number of users whose location is 'London'.", "sql": null }, { "role": "assistant", "content": "SELECT count(*) FROM social_media.users WHERE location = 'London';", "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 social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, par...
[ { "role": "user", "content": "Show me all notifications where the target entity type is 'comment', and for each notification, include the content of the corresponding comment.", "sql": null }, { "role": "assistant", "content": "SELECT n.*, c.content AS comment_content FROM social_media.notif...
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, applicat...
[ { "role": "user", "content": "List all document IDs and their corresponding location names for documents that are associated with applications assigned to a service location in the city of 'Los Angeles'.", "sql": null }, { "role": "assistant", "content": "SELECT d.document_id, sl.location_na...
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.text, record_id.text, patient_id.text, doctor_id...
[ { "role": "user", "content": "I need to list all chronic diagnoses that have at least one prescription, including diagnosis_code, diagnosis_date, and medication_name.", "sql": null }, { "role": "assistant", "content": "SELECT d.diagnosis_code, d.diagnosis_date, m.medication_name\nFROM health...
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, username.text, email.text, password_hash...
[ { "role": "user", "content": "Show me the items in player inventory for player ID 'abcdefgh-1234-5678-abcd-efghijklmnop'. List the item name and quantity.", "sql": null }, { "role": "assistant", "content": "SELECT ii.item_name, pi.quantity FROM gaming_technology.player_inventory pi JOIN gami...
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.notifications ( notification_id.text, user_id.text, message.text, s...
[ { "role": "user", "content": "I want to find the average time it takes for a notification to be marked as read, calculated for each user. Please show the user ID and the average read time in seconds, considering only notifications that have been read.", "sql": null }, { "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 legal_services.documents ( document_id text, case_id text, document_name text, docum...
[ { "role": "user", "content": "List all unique document types along with the count of documents for each type.", "sql": null }, { "role": "assistant", "content": "SELECT document_type, COUNT(*) AS document_count FROM legal_services.documents GROUP BY document_type;", "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 text, policy_id text, customer_id text, incident_date ti...
[ { "role": "user", "content": "I want a list of all claims where at least one document is larger than 2 megabytes. Include the claim ID, incident date, and the file name of such documents.", "sql": null }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, d.file_name\nFRO...
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(), -...
[ { "role": "user", "content": "Show me a list of all achievements with their name, point value, and the title of the game they are part of.", "sql": null }, { "role": "assistant", "content": "SELECT\n T1.name,\n T1.points,\n T2.title\nFROM gaming_technology.achievements AS T1\nJOIN gaming_...
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": "How many insurance products are currently marked as inactive?", "sql": null }, { "role": "assistant", "content": "SELECT count(*) FROM insurance.insurance_products WHERE is_active = false;", "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 financial_services.customers ( customer_id character varying(64) NOT NULL, first_nam...
[ { "role": "user", "content": "List each employee and their manager's full name, showing employee_id, employee full name, and manager full name.", "sql": null }, { "role": "assistant", "content": "SELECT\n e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n m.first_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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "Show me the usernames of players who have participated in game sessions on servers located in the same region as server 'XYZ', along with the server name and the region.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT p.username, s.server_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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name characte...
[ { "role": "user", "content": "List all doctors who have prescribed medications with frequency 'Once daily', along with their specialties and the count of such prescriptions per doctor.", "sql": null }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, d.specialty, COUNT(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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash...
[ { "role": "user", "content": "Can you give me the count of players grouped by their status?", "sql": null }, { "role": "assistant", "content": "SELECT status,\n COUNT(*) AS player_count\nFROM gaming_technology.players\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.patient_insurance ( patient_insurance_id character varying(64) NOT NU...
[ { "role": "user", "content": "List all insurance plans that will expire within the next 30 days, showing the patient IDs and subscriber names.", "sql": null }, { "role": "assistant", "content": "SELECT patient_id, subscriber_name, policy_number, expiration_date\nFROM healthcare.patient_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 social_media.users ( user_id character varying(64) NOT NULL, username character vary...
[ { "role": "user", "content": "Show me the post ID, content, and any associated hashtag IDs for posts that have media_type 'image'.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT T1.post_id, T1.content, T2.hashtag_id FROM social_media.posts AS T1 JOIN social_media.post_ha...
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": "How many notifications related to services were sent for each service category in the past 7 days?", "sql": null }, { "role": "assistant", "content": "SELECT\n s.category,\n COUNT(n.notification_id) AS notification_count\nFROM\n government_services.notificati...
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": "List all distinct pairs of hashtag_id that are applied to the same post_id.", "sql": null }, { "role": "assistant", "content": "SELECT ph1.post_id, ph1.hashtag_id AS hashtag1_id, ph2.hashtag_id AS hashtag2_id\nFROM social_media.post_hashtags ph1\nJOIN social_med...
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, -- uniqu...
[ { "role": "user", "content": "For each vehicle, show the first and last fueling events including their timestamps and the quantities refueled.", "sql": null }, { "role": "assistant", "content": "WITH first_last AS (\n SELECT\n vehicle_id,\n MIN(log_timestamp) AS first_time,\n MAX(l...
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.events ( event_id text PRIMARY KEY, contract_id text, event_name text, data tex...
[ { "role": "user", "content": "Show me all token transfers where the corresponding transaction also emitted an event named 'Transfer', along with the transfer value and event data.", "sql": null }, { "role": "assistant", "content": "SELECT tt.transfer_id, tt.value, e.data FROM web3.token_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 financial_services.securities ( security_id character varying(64) NOT NULL, -- u...
[ { "role": "user", "content": "Show the number of securities per exchange and the average length of their ticker symbols, including only exchanges that have more than 5 securities.", "sql": null }, { "role": "assistant", "content": "SELECT exchange, COUNT(*) AS securities_count, AVG(LENGTH(ti...
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": "What is the total amount paid by each customer? Show the customer_id and the sum of amount_paid.", "sql": null }, { "role": "assistant", "content": "SELECT customer_id, SUM(amount_paid) FROM insurance.premium_payments GROUP BY customer_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 legal_services.clients ( client_id text, first_name text, last_name text, company_na...
[ { "role": "user", "content": "Show me the total number of hours worked by each lawyer for each case.", "sql": null }, { "role": "assistant", "content": "SELECT t.lawyer_id, t.case_id, SUM(t.hours_spent) AS total_hours\nFROM legal_services.time_entries t\nGROUP BY t.lawyer_id, t.case_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 hospitality_technology.room_types ( room_type_id text, property_id text, type_name t...
[ { "role": "user", "content": "List each payment's currency_code, total amount paid, and the number of service orders placed by the same guest for the same reservation.", "sql": null }, { "role": "assistant", "content": "SELECT p.payment_id,\n p.currency_code,\n p.amount AS paymen...
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": "Find all male-female citizen pairs born in the same year. Display the male's full name, the female's full name, and their shared birth year.", "sql": null }, { "role": "assistant", "content": "SELECT\n m.first_name || ' ' || m.last_name AS male_full_name,\n f....
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(), -...
[ { "role": "user", "content": "Show me each player's username along with the total number of achievements they have unlocked.", "sql": null }, { "role": "assistant", "content": "SELECT p.username, COUNT(pa.achievement_id) AS total_unlocked\nFROM gaming_technology.players p\nJOIN gaming_techno...
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.assets ( asset_id character varying(64) NOT NULL, name character va...
[ { "role": "user", "content": "Show me all assets whose symbol starts with 'BTC' or 'ETH', along with their full names and types.", "sql": null }, { "role": "assistant", "content": "SELECT asset_id, name, symbol, type FROM trading_platform.assets WHERE symbol LIKE 'BTC%' OR symbol LIKE 'ETH%'...
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 cex_token_balance ( snapshot_time.text, chain.text, address.text, exchange.text, tok...
[ { "role": "user", "content": "Which exchanges hold the largest total USD value of tokens on the BSC chain in the most recent snapshot, and what is the top token (by usd_value) held by each exchange?", "sql": null }, { "role": "assistant", "content": "WITH latest_snapshot AS (\n SELECT MAX(s...
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": "Retrieve the total revenue and order count for each department for services in July 2023. Show department, revenue, and order_count.", "sql": null }, { "role": "assistant", "content": "SELECT s.department,\n SUM(o.total_price) AS revenue,\n COUNT(o.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 web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for...
[ { "role": "user", "content": "For each event recorded, list its ID, name, and the status and value of the transaction in which it occurred.", "sql": null }, { "role": "assistant", "content": "SELECT E.event_id, E.event_name, E.transaction_id, T.status, T.value FROM web3.events AS E JOIN web3...
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 character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "List all bookings with the passenger's full name, booking status, and fare amount, but only for bookings where the fare is greater than 50.", "sql": null }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, b.status, b.fare FROM transportation...
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.staff ( staff_id text PRIMARY KEY, property_id text, first_na...
[ { "role": "user", "content": "Which staff members have terminated employment? Show their names, hire and termination dates, and the property ID.", "sql": null }, { "role": "assistant", "content": "SELECT staff_id, first_name, last_name, hire_date, termination_date, property_id\nFROM hospital...
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, prop...
[ { "role": "user", "content": "List each property along with the total revenue generated from all delivered service orders, including the property name and total revenue.", "sql": null }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, SUM(so.total_price) AS total_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 hospitality_technology.properties ( property_id text, property_name text, address_li...
[ { "role": "user", "content": "Calculate the average star rating for each property type.", "sql": null }, { "role": "assistant", "content": "SELECT property_type, AVG(star_rating) AS average_star_rating FROM hospitality_technology.properties GROUP BY property_type;", "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.agencies ( agency_id character varying(64) NOT NULL, agency_name...
[ { "role": "user", "content": "List the name of each agency and the number of appointments associated with services from that agency.", "sql": null }, { "role": "assistant", "content": "SELECT T1.agency_name, COUNT(T2.appointment_id) FROM agencies AS T1 JOIN appointments AS T2 ON T1.agency_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 legal_services.time_entries ( entry_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Show me all pairs of time entries made by the same lawyer on the same date. Include both entry IDs, lawyer_id, and date_worked.", "sql": null }, { "role": "assistant", "content": "SELECT t1.lawyer_id, t1.date_worked, t1.entry_id AS entry_id_1, t2.entry_id AS ent...
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": "Can you show me the company name, email, and phone of all clients who share the same status?", "sql": null }, { "role": "assistant", "content": "SELECT a.company_name, a.email, a.phone, a.status\nFROM legal_services.clients a\nJOIN legal_services.clients b ON 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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising reco...
[ { "role": "user", "content": "List the total amount invested in each month of 2023.", "sql": null }, { "role": "assistant", "content": "SELECT SUBSTRING(investment_date, 1, 7) AS month, SUM(investment_value) AS total_invested FROM project_fundraising_record WHERE investment_date LIKE '2023%'...
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.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text...
[ { "role": "user", "content": "Show me each lawyer’s full name and the count of distinct cases they have logged time against.", "sql": null }, { "role": "assistant", "content": "SELECT l.first_name || ' ' || l.last_name AS lawyer_name, COUNT(DISTINCT te.case_id) AS case_count\nFROM 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 government_services.services ( service_id text PRIMARY KEY, agency_id text, service_...
[ { "role": "user", "content": "List the payment ID, amount, and the name of the service for all payments associated with services in the 'Licensing' category.", "sql": null }, { "role": "assistant", "content": "SELECT p.payment_id, p.amount, s.service_name FROM government_services.payments 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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text...
[ { "role": "user", "content": "List each user's username, email, and the total count of log entries they have recorded.", "sql": null }, { "role": "assistant", "content": "SELECT T1.username, T1.email, count(T2.log_id) FROM users AS T1 LEFT JOIN logs AS T2 ON T1.user_id = T2.user_id GROUP BY ...
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.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Show each lawyer's first and last name along with the number of open cases they lead, ordered by the highest number of open cases first.", "sql": null }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, COUNT(c.case_id) AS open_case_count\nFR...