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 legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, c...
[ { "role": "user", "content": "Which lawyers have scheduled appointments at each location? Please list the lawyer_id, location, and the number of scheduled appointments per lawyer per location.", "sql": null }, { "role": "assistant", "content": "SELECT lawyer_id, location, COUNT(*) AS schedul...
You are an expert in writing database language. You can write a corresponding 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": "For each network, list the deployer address and the number of contracts they have deployed, ordered from most to least.", "sql": null }, { "role": "assistant", "content": "SELECT network_id, deployer_address, COUNT(*) AS deployed_contracts FROM web3.contracts 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text,...
[ { "role": "user", "content": "Retrieve each agency’s name along with the count of accessible service locations it has in California.", "sql": null }, { "role": "assistant", "content": "SELECT\n a.agency_name,\n COUNT(l.location_id) AS accessible_location_count\nFROM government_services.age...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Find pairs of distinct token transfers that occurred in the same transaction and were initiated by the same sender address. List the transaction ID, the common sender address, and both transfer IDs.", "sql": null }, { "role": "assistant", "content": "SELECT\n 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 gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, ser...
[ { "role": "user", "content": "Show me the total number of sessions and the total duration in seconds for each server, including the server name and the game title.", "sql": null }, { "role": "assistant", "content": "SELECT\n s.server_name,\n g.game_title,\n COUNT(gs.session_id) AS total_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 gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_...
[ { "role": "user", "content": "For each player, list the total number of 'Legendary' rarity items they have in their inventory, along with the titles of the respective games those items belong to.", "sql": null }, { "role": "assistant", "content": "SELECT pi.player_id, g.game_id, g.title, 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 healthcare.appointments ( appointment_id character varying(64) NOT NULL, -- uniq...
[ { "role": "user", "content": "List the appointment_id, patient_id, and reason for all appointments where the notes mention 'urgent'.", "sql": null }, { "role": "assistant", "content": "SELECT appointment_id, patient_id, reason\nFROM healthcare.appointments\nWHERE notes ILIKE '%urgent%';", ...
You are an expert in writing database language. You can write a corresponding 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_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexp...
[ { "role": "user", "content": "Which two tokens on each chain have the greatest difference in their 24h price change percentage? Show token_symbol A, token_symbol B, chain, and the absolute difference.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT ON (t1.chain)\n t1.tok...
You are an expert in writing database language. You can write a corresponding 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 the full names of patients who have ever been prescribed a medication manufactured by 'Novartis'.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT p.first_name, p.last_name\nFROM healthcare.patients p\nJOIN healthcare.prescriptions pr 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.routes ( route_id.text, route_number.text, description.text, origin_l...
[ { "role": "user", "content": "Find all pairs of distinct routes that share the same origin location ID. List the route IDs and route numbers for both routes in each pair, along with the shared origin location ID.", "sql": null }, { "role": "assistant", "content": "SELECT r1.route_id AS route...
You are an expert in writing database language. You can write a corresponding 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": "Find all documents with version greater than 1 and include the case number, case name, and the full name of the lawyer who uploaded them.", "sql": null }, { "role": "assistant", "content": "SELECT d.document_id,\n d.document_name,\n c.case_number,\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.service_orders ( order_id text PRIMARY KEY, reservation_id te...
[ { "role": "user", "content": "Show me the total quantity and total price for each service ordered by each guest.", "sql": null }, { "role": "assistant", "content": "SELECT guest_id, service_id, SUM(quantity) AS total_quantity, SUM(total_price) AS total_price FROM hospitality_technology.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 gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, ...
[ { "role": "user", "content": "How many inventory items are recorded in total?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM player_inventory;", "sql": null }, { "role": "user", "content": "Okay, now show me the total quantity of items for each speci...
You are an expert in writing database language. You can write a corresponding 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": "For each employee, show their full name, their manager's full name, and the number of days between their hire dates.", "sql": null }, { "role": "assistant", "content": "SELECT e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n m....
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT N...
[ { "role": "user", "content": "List all reservations made in the last 6 months, showing the reservation ID, guest ID, and status.", "sql": null }, { "role": "assistant", "content": "SELECT reservation_id, guest_id, status FROM hospitality_technology.reservations WHERE created_at >= current_da...
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT NULL, created...
[ { "role": "user", "content": "Provide a breakdown of the total number of conversations, showing how many are group chats and how many are not. Also, show the count of conversations that have a recorded last message time.", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) AS ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.payments ( payment_id character varying(64) NOT NULL, applicatio...
[ { "role": "user", "content": "Show me the total payment amount and number of payments for each service.", "sql": null }, { "role": "assistant", "content": "SELECT service_id, SUM(amount) AS total_amount, COUNT(*) AS payment_count FROM government_services.payments GROUP BY service_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.staff ( staff_id text, property_id text, first_name text, las...
[ { "role": "user", "content": "List the full names and email addresses of staff members who have delivered at least one service order in the past 30 days, along with the count of orders they delivered. Sort by count descending.", "sql": null }, { "role": "assistant", "content": "SELECT st.sta...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, propert...
[ { "role": "user", "content": "List all services provided by the property named 'Grand Plaza Hotel' and include their category and price.", "sql": null }, { "role": "assistant", "content": "SELECT T1.service_name, T1.category, T1.price FROM hospitality_technology.services AS T1 JOIN hospitali...
You are an expert in writing database language. You can write a corresponding 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 the latest version of each document (identified by case_id and document_name), showing the version number and its upload_timestamp.", "sql": null }, { "role": "assistant", "content": "SELECT d.case_id,\n d.document_name,\n d.version AS latest_...
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT NULL, -- uni...
[ { "role": "user", "content": "For each passenger, list their email along with the total amount spent on fares across all their bookings.", "sql": null }, { "role": "assistant", "content": "SELECT p.passenger_id, p.email, SUM(b.fare) AS total_fare_spent\nFROM transportation.passengers p\nJOIN...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name...
[ { "role": "user", "content": "Show each agency along with its parent agency’s name and jurisdiction level.", "sql": null }, { "role": "assistant", "content": "SELECT child.agency_id, child.agency_name, child.jurisdiction_level, parent.agency_name AS parent_agency_name, parent.jurisdiction_le...
You are an expert in writing database language. You can write a corresponding 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": "List all wallet addresses and their amount holding more than 10,000 units of any ERC20 token.", "sql": null }, { "role": "assistant", "content": "SELECT wallet_address, contract_address, amount FROM erc20_balances WHERE CAST(amount AS numeric) > 10000;", "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 // Use Hashes for ticket details. Key format: ticket:<ticket_id> // HSET ticket:tkt_1a2b ticket_i...
[ { "role": "user", "content": "特定の予約ID 'book_zyx' に関連するすべてのチケットの詳細を取得するのを手伝っていただけますか?また、関連する車両情報も含めてください。", "sql": null }, { "role": "assistant", "content": "SMEMBERS booking:book_zyx:tickets\nHGETALL ticket:<ticket_id>\nHGETALL car:<car_id>", "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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "List all players and the number of distinct games they have grabbed in-game items from, as well as the name of each game.", "sql": null }, { "role": "assistant", "content": "SELECT p.player_id, p.username, g.game_id, g.title, COUNT(DISTINCT pi.item_id) AS distin...
You are an expert in writing database language. You can write a corresponding 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": "Show the total USD value held by CEX addresses for each token belonging to the 'Gaming' narrative. List the token symbol, narrative, and the total USD value across all CEX holdings for that token.", "sql": null }, { "role": "assistant", "content": "SELECT ctb.to...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, -- ...
[ { "role": "user", "content": "List all food and beverage services (category = 'Food & Beverage') with their names, prices, and units, where the price is less than $20.", "sql": null }, { "role": "assistant", "content": "SELECT service_name, price, unit FROM hospitality_technology.services 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 legal_services.documents ( document_id text, case_id text, document_name text, docum...
[ { "role": "user", "content": "Show me the document name, upload timestamp, time entry date worked, and hours spent for all entries related to case 'CASE_XYZ'.", "sql": null }, { "role": "assistant", "content": "SELECT T1.document_name , T1.upload_timestamp , T2.date_worked , T2.hours_spen...
You are an expert in writing database language. You can write a corresponding 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": "How many citizens are there in each gender?", "sql": null }, { "role": "assistant", "content": "SELECT gender, COUNT(*) AS citizen_count\nFROM government_services.citizens\nGROUP BY gender;", "sql": null }, { "role": "user", "content": "Filter to...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text,...
[ { "role": "user", "content": "Retrieve the passenger_id, first_name, last_name, and total number of bookings each passenger has made in 2023, including only those with at least one booking.", "sql": null }, { "role": "assistant", "content": "SELECT p.passenger_id, p.first_name, p.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 hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_na...
[ { "role": "user", "content": "Find all staff members who are managers and list their direct reports. Show the manager's first name, last name, and the direct report's first name, last name, and position.", "sql": null }, { "role": "assistant", "content": "SELECT m.first_name AS manager_first...
You are an expert in writing database language. You can write a corresponding 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.trips ( trip_id character varying(64) NOT NULL, -- unique identi...
[ { "role": "user", "content": "Retrieve trip_id and passenger full names for all trips where the passenger record was created before the scheduled departure.", "sql": null }, { "role": "assistant", "content": "SELECT t.trip_id, p.first_name || ' ' || p.last_name AS passenger_name\nFROM transp...
You are an expert in writing database language. You can write a corresponding 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": "Can you list all vehicles acquired in 2023, their make, model, and acquisition date?", "sql": null }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, acquisition_date FROM transportation.vehicles WHERE acquisition_date >= '2023-01-01' AND acqu...
You are an expert in writing database language. You can write a corresponding 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 type and base premium. Also, show whether each product is active.", "sql": null }, { "role": "assistant", "content": "SELECT product_id, product_name, product_type, base_premium, is_active FROM insurance.insurance_pro...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id tex...
[ { "role": "user", "content": "How many time entries were recorded on each date? List the date and the count of entries for that date, ordered by date.", "sql": null }, { "role": "assistant", "content": "SELECT date_worked, COUNT(*) AS entry_count FROM legal_services.time_entries GROUP BY dat...
You are an expert in writing database language. You can write a corresponding 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 PRIMARY KEY, route_number text, description te...
[ { "role": "user", "content": "Show all routes where the estimated duration is at least 120 minutes including their route number, type, and origin and destination location IDs.", "sql": null }, { "role": "assistant", "content": "SELECT route_number, type, origin_location_id, destination_locat...
You are an expert in writing database language. You can write a corresponding 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 PRIMARY KEY, medication_name text, gener...
[ { "role": "user", "content": "I want to see pairs of medications that share the same manufacturer. Show each medication's name and its peer's medication_name along with the manufacturer.", "sql": null }, { "role": "assistant", "content": "SELECT t1.medication_name AS med1_name, t2.medication...
You are an expert in writing database language. You can write a corresponding 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": "List all users who created a wallet on the same day they registered. Show user ID, username, and the wallet address.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id, u.username, w.address FROM web3.users AS u JOIN web3.wallets AS w ON u.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 trading_platform.peers ( peer_id character varying(64) NOT NULL, ip_address characte...
[ { "role": "user", "content": "Show all peers whose last_seen timestamp is before '2023-01-01' and whose port number is less than 1000, listing their peer_id and ip_address.", "sql": null }, { "role": "assistant", "content": "SELECT peer_id, ip_address FROM trading_platform.peers WHERE last_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 financial_services.transactions ( transaction_id character varying(64) NOT NULL,...
[ { "role": "user", "content": "How many transactions are there for each status?", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS transaction_count FROM financial_services.transactions GROUP BY status;", "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.maintenance_logs ( log_id character varying(64) NOT NULL, -- uni...
[ { "role": "user", "content": "Show me all maintenance logs for 'Engine Repair' service type where the cost is greater than 400, including the vehicle ID, service date, cost, and mechanic name.", "sql": null }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost, mechanic...
You are an expert in writing database language. You can write a corresponding 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 distinct plan types available in the insurance_plans table.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT plan_type FROM healthcare.insurance_plans;", "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.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 published posts with media_type 'video', along with the creation time of each post.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, u.email, p.created_at\nFROM social_media.users u\n...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "Show all claims and the full name of the customer who filed each claim.", "sql": null }, { "role": "assistant", "content": "SELECT T1.claim_id, T1.incident_date, T1.description, T2.first_name, T2.last_name FROM insurance.claims AS T1 JOIN insurance.customers 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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.t...
[ { "role": "user", "content": "List each user along with the number of wallets they own and the number of unique addresses found in their UTXOs.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id, COUNT(DISTINCT w.wallet_id) as wallet_count, COUNT(DISTINCT ut.address) as uni...
You are an expert in writing database language. You can write a corresponding 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": "Find users who have both commented on a post and liked that same post. Return the user_id and the count of such posts as post_count.", "sql": null }, { "role": "assistant", "content": "SELECT c.user_id, COUNT(DISTINCT c.post_id) AS post_count\nFROM social_media....
You are an expert in writing database language. You can write a corresponding 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 all beneficiaries with a percentage_share greater than 30%, showing beneficiary_id, first_name, last_name, relationship, percentage_share, and policy_id.", "sql": null }, { "role": "assistant", "content": "SELECT beneficiary_id,\n first_name,\n ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL,...
[ { "role": "user", "content": "Retrieve all room types with a base_rate above 150 for each property.", "sql": null }, { "role": "assistant", "content": "SELECT property_id, type_name, base_rate\nFROM hospitality_technology.room_types\nWHERE base_rate > 150;", "sql": null }, { "rol...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,...
[ { "role": "user", "content": "I need to list the top 5 ERC20 tokens by total supply, including symbol, contract_address, and name.", "sql": null }, { "role": "assistant", "content": "SELECT tm.contract_address, tm.symbol, tm.name, CAST(tm.total_supply AS DECIMAL) AS total_supply\nFROM token_...
You are an expert in writing database language. You can write a corresponding 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.market_data ( data_point_id bigserial NOT NULL, -- auto-incre...
[ { "role": "user", "content": "For each date in the last 30 days with market data, show the total volume and the maximum high price recorded.", "sql": null }, { "role": "assistant", "content": "SELECT data_timestamp::date, SUM(volume) AS total_volume, MAX(high_price) AS max_high_price 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": "Show me the total value of assets purchased by each user (sum of quantity * price for trades where they were the buyer). Include user ID and username.", "sql": null }, { "role": "assistant", "content": "SELECT T1.user_id , T1.username , sum(T2.quantity * T2.pric...
You are an expert in writing database language. You can write a corresponding 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 PRIMARY KEY, route_number text, description te...
[ { "role": "user", "content": "What is the average fare for bookings with status 'Completed'?", "sql": null }, { "role": "assistant", "content": "SELECT AVG(fare) FROM transportation.bookings WHERE status = 'Completed';", "sql": null }, { "role": "user", "content": "What about...
You are an expert in writing database language. You can write a corresponding 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": "Find all documents that are larger than 5MB. Show the document ID, claim ID, file name, and file size in bytes.", "sql": null }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name, file_size_bytes\nFROM insurance.claim_documents\nWHERE 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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "Show me the make and model of vehicles used on routes longer than 150 kilometers, and include the route number.", "sql": null }, { "role": "assistant", "content": "SELECT v.make, v.model, r.route_number \nFROM transportation.trips t\nJOIN transportation.vehicles...
You are an expert in writing database language. You can write a corresponding 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": "For each document (identified by case_id and document_name), find the latest version number and the ID of the lawyer who uploaded that version.", "sql": null }, { "role": "assistant", "content": "WITH RankedDocuments AS ( SELECT document_id, case_id, document_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 legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case...
[ { "role": "user", "content": "Show me invoices with a null `payment_date`. Include invoice number, total amount, and due date.", "sql": null }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, due_date FROM invoices WHERE payment_date IS 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text,...
[ { "role": "user", "content": "List the appointment ID, the scheduled start time, and the name of the service location for all appointments scheduled between '2024-01-01' and '2024-12-31'.", "sql": null }, { "role": "assistant", "content": "SELECT T1.appointment_id, T1.scheduled_start_time, 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.citizens ( citizen_id character varying(64) NOT NULL, national_i...
[ { "role": "user", "content": "For each service category, find the total number of notifications sent related to applications of services in that category.", "sql": null }, { "role": "assistant", "content": "SELECT s.category, COUNT(n.notification_id) AS notification_count\nFROM government_se...
You are an expert in writing database language. You can write a corresponding 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.text, top_3_coins.text, price_change_percentage_1h.numeri...
[ { "role": "user", "content": "List the top 10 narratives based on their market cap. Display the narrative name, market_cap, and token_num.", "sql": null }, { "role": "assistant", "content": "SELECT narrative, market_cap, token_num FROM narrative_info ORDER BY market_cap DESC LIMIT 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 government_services.service_locations ( location_id character varying(64) NOT NU...
[ { "role": "user", "content": "Find all service locations whose postal code starts with '75' and display their names, cities, and operating hours, including the agency ID.", "sql": null }, { "role": "assistant", "content": "SELECT location_name, city, operating_hours, agency_id FROM governmen...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "Show me all users who have liked both a comment and a post, including their user IDs.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT l1.user_id\nFROM social_media.likes l1\nJOIN social_media.likes l2 ON l1.user_id = l2.user_id\nWHERE l1.post...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "List all law firms that have not provided a website.", "sql": null }, { "role": "assistant", "content": "SELECT firm_id, firm_name FROM legal_services.law_firms WHERE website IS NULL;", "sql": null }, { "role": "user", "content": "Please include ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi...
[ { "role": "user", "content": "List the username, registration date, and address of all users who have created a wallet.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, u.created_at AS registration_date, w.address AS wallet_address\nFROM web3.users u\nJOIN web3.wallets ...
You are an expert in writing database language. You can write a corresponding 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 each employee's first and last name along with the number of appointments they have scheduled in March 2024.", "sql": null }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, COUNT(ap.appointment_id) AS appointment_count\nFROM government...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level....
[ { "role": "user", "content": "I would like to see a list of agencies and the names of their respective parent agencies.", "sql": null }, { "role": "assistant", "content": "SELECT a.agency_id, a.agency_name, p.agency_name AS parent_agency_name\nFROM government_services.agencies a\nLEFT JOIN g...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character ...
[ { "role": "user", "content": "List each user’s user_id and username along with their total trading value (sum of quantity * price from trades) as a buyer for trades executed in June 2024. Show the top 5 users by total value descending.", "sql": null }, { "role": "assistant", "content": "SELE...
You are an expert in writing database language. You can write a corresponding 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, -- uni...
[ { "role": "user", "content": "List all insurance products with a base premium greater than 1000 and less than 5000. Show the product name, product type, and base premium.", "sql": null }, { "role": "assistant", "content": "SELECT product_name, product_type, base_premium FROM insurance.insura...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi...
[ { "role": "user", "content": "Find all contracts deployed by users who have also conducted transactions with a value greater than 1 ETH (where 1 ETH = 1e18 wei).", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT c.contract_id, c.address, c.deployer_address FROM web3.contrac...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_bir...
[ { "role": "user", "content": "Show me the policy number, start date, end date, product name, and product type for all policies.", "sql": null }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.start_date, T1.end_date, T2.product_name, T2.product_type FROM insurance.policies 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "For each reservation, can you show the guest's full name, the property name, and the room number?", "sql": null }, { "role": "assistant", "content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS guest_full_name, p.property_name, rm.room_number\...
You are an expert in writing database language. You can write a corresponding 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 PRIMARY KEY, route_number text, description te...
[ { "role": "user", "content": "For each vehicle that appears in both the maintenance logs and fuel logs tables, calculate the total maintenance cost and the total fuel cost. Display the vehicle ID and these two total costs.", "sql": null }, { "role": "assistant", "content": "SELECT T1.vehicle...
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "For each asset, calculate the total quantity and average price of orders that have status 'filled'.", "sql": null }, { "role": "assistant", "content": "SELECT o.asset_id,\n SUM(o.quantity) AS total_quantity,\n AVG(o.price) AS average_price\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 insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, ...
[ { "role": "user", "content": "Show me all claim documents that are PDFs and were uploaded in the last 30 days, along with their claim IDs and file sizes.", "sql": null }, { "role": "assistant", "content": "SELECT cd.document_id, cd.claim_id, cd.file_size_bytes, c.policy_id FROM insurance.cla...
You are an expert in writing database language. You can write a corresponding 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": "Show the number of reservations and the sum total_amount for each property.", "sql": null }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, COUNT(r.reservation_id) AS reservation_count, SUM(r.total_amount) AS total_revenue \nFROM hospi...
You are an expert in writing database language. You can write a corresponding 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, -- uni...
[ { "role": "user", "content": "Find pairs of products with the same product_type but different is_active statuses. Include product_type, active product_id, active product_name, inactive product_id, and inactive product_name.", "sql": null }, { "role": "assistant", "content": "SELECT\n p_acti...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "List all appointments scheduled for clients whose status is 'prospect', showing the client's first name, last name, and the appointment subject.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.subject FROM legal_services.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 character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "What is the sum of the amounts for all payments that have a status of 'Completed'?", "sql": null }, { "role": "assistant", "content": "SELECT sum(amount) FROM government_services.payments WHERE status = 'Completed'", "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.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT ...
[ { "role": "user", "content": "Give me the number of achievements unlocked each day, returning unlock_date and unlock_count.", "sql": null }, { "role": "assistant", "content": "SELECT date_trunc('day', unlocked_at)::date AS unlock_date,\n COUNT(*) AS unlock_count\nFROM gaming_technology...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text,...
[ { "role": "user", "content": "For each service location, show its name and the total number of appointments that have been scheduled there.", "sql": null }, { "role": "assistant", "content": "SELECT T1.location_name, COUNT(T2.appointment_id) AS total_appointments FROM government_services.ser...
You are an expert in writing database language. You can write a corresponding 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": "Which DApps have the word 'exchange' in their description?", "sql": null }, { "role": "assistant", "content": "SELECT name, description\nFROM trading_platform.dapps\nWHERE description ILIKE '%exchange%';", "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 PRIMARY KEY, policy_id text, cu...
[ { "role": "user", "content": "How many beneficiaries has each unique relationship type? List relationship and the count.", "sql": null }, { "role": "assistant", "content": "SELECT relationship, COUNT(*) AS beneficiary_count\nFROM insurance.policy_beneficiaries\nGROUP BY relationship;", "...
You are an expert in writing database language. You can write a corresponding 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": "Find pairs of patients who share the same last name. Show the patient IDs, full names, and the shared last name.", "sql": null }, { "role": "assistant", "content": "SELECT p1.patient_id AS patient1_id, p1.first_name AS patient1_first_name, p1.last_name AS patien...
You are an expert in writing database language. You can write a corresponding 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.trips ( trip_id character varying(64) NOT NULL, route_id character va...
[ { "role": "user", "content": "For each vehicle, list the vehicle_id and the total number of trips it has performed.", "sql": null }, { "role": "assistant", "content": "SELECT vehicle_id, COUNT(*) AS trip_count FROM transportation.trips GROUP BY vehicle_id;", "sql": null }, { "rol...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text,...
[ { "role": "user", "content": "Show me claim IDs, incident dates, and file names for all 'Accident Report' claim documents.", "sql": null }, { "role": "assistant", "content": "SELECT cd.claim_id, cl.incident_date, cd.file_name\nFROM insurance.claim_documents cd\nJOIN insurance.claims cl ON cd...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Show me the total billable hours per lawyer from the time_entries table.", "sql": null }, { "role": "assistant", "content": "SELECT lawyer_id, SUM(hours_spent) AS total_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\nGROUP BY lawyer_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.properties ( property_id text PRIMARY KEY, property_name text...
[ { "role": "user", "content": "For each reservation in the last three months, show the reservation ID, check-in date, number of adults, and the corresponding room type name.", "sql": null }, { "role": "assistant", "content": "SELECT r.reservation_id, r.check_in_date, r.num_adults, rt.type_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 text, first_name text, last_name text, date_of_birt...
[ { "role": "user", "content": "Show all prescriptions made in 2024 for medications prescribed during appointments scheduled at location 'LOC001', including prescription_id, patient_id, medication_id, and appointment_time.", "sql": null }, { "role": "assistant", "content": "SELECT pr.prescript...
You are an expert in writing database language. You can write a corresponding 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": "List the first_name, last_name, and email of all clients whose email domain is 'gmail.com'.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE SUBSTRING(email FROM POSITION('@' IN email) + 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.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "List all group chats and the total count of messages sent in each one.", "sql": null }, { "role": "assistant", "content": "SELECT T1.group_name, count(T2.message_id) AS message_count FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.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 financial_services.loans ( loan_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "Show me a summary per loan_type with the minimum interest_rate, maximum interest_rate, and the average current_principal_balance.", "sql": null }, { "role": "assistant", "content": "SELECT loan_type,\n MIN(interest_rate) AS min_interest_rate,\n MAX(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 social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "List the usernames and emails of users who have set a location in their profile.", "sql": null }, { "role": "assistant", "content": "SELECT username, email\nFROM social_media.users\nWHERE location IS NOT NULL AND location != '';", "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 character varying(64) NOT NULL,...
[ { "role": "user", "content": "Show me the count of service orders for each distinct status.", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(order_id) FROM hospitality_technology.service_orders GROUP BY status;", "sql": null }, { "role": "user", "conte...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Index 'aircraft_models'. Mapping: { properties: { model_id: { type: 'keyword' }, model_name: { ty...
[ { "role": "user", "content": "I need to get the total quantity of components in inventory for a specific warehouse location. Can you help with that?", "sql": null }, { "role": "assistant", "content": "SELECT location_warehouse, SUM(quantity) AS total_quantity\nFROM component_inventory\nWHERE...
You are an expert in writing database language. You can write a corresponding 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 PRIMARY KEY, policy_id text, cu...
[ { "role": "user", "content": "How many distinct relationships are listed for policy beneficiaries?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT relationship) FROM insurance.policy_beneficiaries;", "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.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "List all users who have a non-empty bio and a profile picture URL.", "sql": null }, { "role": "assistant", "content": "SELECT\n user_id,\n username,\n full_name,\n bio,\n profile_picture_url\nFROM social_media.users\nWHERE\n bio IS NOT NULL AND profile_pic...
You are an expert in writing database language. You can write a corresponding 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": "I want a report of public posts with images in the last 30 days that shows post_id, content, author's username and email, and the count of likes, ordered by like count descending, limit to top 5.", "sql": null }, { "role": "assistant", "content": "SELECT p.post_...
You are an expert in writing database language. You can write a corresponding 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.rooms ( room_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "How many reservations are there per status?", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM hospitality_technology.reservations GROUP BY status;", "sql": null }, { "role": "user", "content": "Only count reservatio...
You are an expert in writing database language. You can write a corresponding 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.medical_records ( record_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "List the record ID, record date, patient ID, and chief complaint for medical records belonging to patients whose last name is 'Smith'. Also include the patient's last name in the results.", "sql": null }, { "role": "assistant", "content": "SELECT mr.record_id, m...
You are an expert in writing database language. You can write a corresponding 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": "Show me the usernames of buyers along with the names of assets they have traded.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT u.username, a.name AS asset_name\nFROM trading_platform.trades t\nJOIN trading_platform.users u ON t.buyer_id = 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 healthcare.medical_records ( record_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Can you show me the details of all medical records for patients that had their vitals recorded with a temperature above 38 degrees Celsius, along with any medication descriptions that mention 'antipyretic'?", "sql": null }, { "role": "assistant", "content": "SEL...