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 narrative_info (", "narrative character varying(512) NOT NULL, -- the id of na...
[ { "role": "user", "content": "Which smart money address on the 'Ethereum' chain has the highest profit from tokens in the 'DeFi' narrative, and what is their ROI?", "sql": null }, { "role": "assistant", "content": "SELECT sm.address, sm.profit, sm.roi\nFROM smart_money_profit sm\nJOIN smart_...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id text, property_id text, guest_i...
[ { "role": "user", "content": "Show me pairs of reservations by the same guest where the next reservation starts within 7 days of the previous check-out. Include both reservation IDs and property IDs.", "sql": null }, { "role": "assistant", "content": "SELECT r1.reservation_id AS first_reserv...
You are an expert in writing database language. You can write a corresponding 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": "List all properties together with the floor numbers and room numbers of their rooms located in cities with a star rating greater than 4.", "sql": null }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, p.city, p.star_rating, r.floor, r....
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appo...
[ { "role": "user", "content": "Show all appointments along with the related medical record's record_id and chief complaint, for appointments scheduled in June 2024.", "sql": null }, { "role": "assistant", "content": "SELECT a.appointment_id, a.patient_id, a.doctor_id, a.appointment_time, mr.r...
You are an expert in writing database language. You can write a corresponding 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": "For each appointment, show the appointment ID, scheduled start time, the name of the service related to the appointment, and the agency name.", "sql": null }, { "role": "assistant", "content": "SELECT a.appointment_id, a.scheduled_start_time, s.service_name, ag....
You are an expert in writing database language. You can write a corresponding 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": "Show me all pairs of cases led by the same lawyer, including both case names and the lead lawyer ID.", "sql": null }, { "role": "assistant", "content": "SELECT c1.lead_lawyer_id,\n c1.case_name AS case_name_1,\n c2.case_name AS case_name_2\nFROM lega...
You are an expert in writing database language. You can write a corresponding 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": "Get the total value and average gas_price for each from_address in transactions, but only include senders who have sent more than 5 transactions.", "sql": null }, { "role": "assistant", "content": "SELECT from_address,\n SUM(value) AS total_value,\n ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name characte...
[ { "role": "user", "content": "Show me the hashtag IDs and their names.", "sql": null }, { "role": "assistant", "content": "SELECT hashtag_id, tag_name FROM social_media.hashtags;", "sql": null }, { "role": "user", "content": "I also want to see when each hashtag was created."...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Show me all reservations, including the guest's full name, the room number, check-in date, and check-out date.", "sql": null }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T3.room_number, T2.check_in_date, T2.check_out_date FROM hospit...
You are an expert in writing database language. You can write a corresponding 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": "For each service, show the service name and the total number of applications submitted for it.", "sql": null }, { "role": "assistant", "content": "SELECT s.service_name, COUNT(a.application_id) AS total_applications\nFROM government_services.services s\nLEFT JOI...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, c...
[ { "role": "user", "content": "Show me each invoice and the invoice_number of the next invoice for the same client, along with how many days apart their issue_dates are.", "sql": null }, { "role": "assistant", "content": "SELECT a.invoice_number AS invoice_number,\n b.invoice_number 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.developers ( developer_id uuid PRIMARY KEY, name text, country tex...
[ { "role": "user", "content": "How many developers are there in each country? Show country and developer_count.", "sql": null }, { "role": "assistant", "content": "SELECT country,\n COUNT(*) AS developer_count\nFROM gaming_technology.developers\nGROUP BY country;", "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 the username and email of users who have disabled push notifications.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, u.email\nFROM social_media.users u\nJOIN social_media.user_settings s ON u.user_id = s.user_id\nWHERE s.push_notific...
You are an expert in writing database language. You can write a corresponding 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 web3.users ( user_id character varying(64) NOT NULL, username character varying(128)...
[ { "role": "user", "content": "For each user, find the previous user by registration time. List current user_id and username, previous user_id and username, and the time difference in minutes between their registrations.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id AS ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name charac...
[ { "role": "user", "content": "List all law firms, showing their name, website, and the ID of their managing partner.", "sql": null }, { "role": "assistant", "content": "SELECT firm_name, website, managing_partner_id FROM law_firms;", "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 hospitality_technology.services ( service_id character varying(64) NOT NULL, propert...
[ { "role": "user", "content": "List all properties and the count of their available services in the 'Activities' category.", "sql": null }, { "role": "assistant", "content": "SELECT T2.property_name, COUNT(T1.service_id) AS available_activities_count FROM hospitality_technology.services AS T1...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text,...
[ { "role": "user", "content": "Show the policy number, start date, and the first and last name of the agent for all policies that started in 2024.", "sql": null }, { "role": "assistant", "content": "SELECT p.policy_number, p.start_date, a.first_name AS agent_first_name, a.last_name AS agent_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 social_media.posts ( post_id character varying(64) NOT NULL, user_id character varyi...
[ { "role": "user", "content": "List all hashtags that have been used on posts created in the last 90 days. Show the tag_name and the date it was first used on a post within this period.", "sql": null }, { "role": "assistant", "content": "SELECT h.tag_name, MIN(p.created_at) AS first_use_date_...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying...
[ { "role": "user", "content": "How many events were emitted on each date? List the date and the count of events.", "sql": null }, { "role": "assistant", "content": "SELECT DATE(emitted_at) AS emit_date,\n COUNT(*) AS event_count\nFROM web3.events\nGROUP BY DATE(emitted_at);", "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 financial_services.trades ( trade_id character varying(64) NOT NULL, -- unique i...
[ { "role": "user", "content": "List the total traded amount and total commission for each security, including the security name.", "sql": null }, { "role": "assistant", "content": "SELECT s.security_id, s.security_name, SUM(t.total_amount) AS total_traded_amount, SUM(t.commission) AS total_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.customers ( customer_id.text, first_name.text, last_name.text, da...
[ { "role": "user", "content": "Show the total sum and average amount for all OUTGOING transactions within the last 30 days, grouped by transaction_type.", "sql": null }, { "role": "assistant", "content": "SELECT transaction_type, SUM(amount) AS total_amount, AVG(amount) AS avg_amount FROM fin...
You are an expert in writing database language. You can write a corresponding 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": "For the 'AI' and 'Gaming' narratives, what is the total USD value held by CEXes for tokens listed in their top 3 coins?", "sql": null }, { "role": "assistant", "content": "SELECT T2.narrative, SUM(T1.usd_value) AS TotalCexUSDValue FROM cex_token_balance AS T1 JO...
You are an expert in writing database language. You can write a corresponding 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": "I want to retrieve all claims with an estimated loss greater than 10000, including the claim ID, incident date, beneficiary first and last name, and relationship.", "sql": null }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, b.first_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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id c...
[ { "role": "user", "content": "For each room type, show the total number of completed reservations and the total amount paid, considering only reservations with status 'CheckedOut'.", "sql": null }, { "role": "assistant", "content": "SELECT rt.type_name, COUNT(r.reservation_id) AS reservation...
You are an expert in writing database language. You can write a corresponding 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, project_id character...
[ { "role": "user", "content": "For each narrative, show its name and the total market cap of all related tokens based on DEX pool data.", "sql": null }, { "role": "assistant", "content": "SELECT n.narrative, SUM(d.market_cap) AS total_market_cap\nFROM narrative_info n\nJOIN token_dexpool_info...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.ti...
[ { "role": "user", "content": "Show all policy beneficiaries along with the total premium amount paid for the policy they are associated with.", "sql": null }, { "role": "assistant", "content": "SELECT T1.beneficiary_id, T1.first_name, T1.last_name, T1.policy_id, T1.percentage_share, SUM(T2.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 Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe...
[ { "role": "user", "content": "Can you help me retrieve the list of components made of a specific material along with their supplier details?", "sql": null }, { "role": "assistant", "content": "SMEMBERS material_components:mat:TI64\nHGETALL component:<component_id>\nHGET component:<component_...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE financial_services.employees ( employee_id character varying(64) NOT NULL, -- u...
[ { "role": "user", "content": "Provide a list of all employees and their corresponding managers. Please display the full name for both the employee and their manager.", "sql": null }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.last_name AS employee_name, 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 transportation.routes ( route_id.text, route_number.text, description.text, origin_l...
[ { "role": "user", "content": "Show all routes where the description mentions the word 'airport'.", "sql": null }, { "role": "assistant", "content": "SELECT route_id, route_number, description, origin_location_id, destination_location_id, distance_km, estimated_duration_minutes, type\nFROM tr...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "Show all users who have liked comments made by users with a specified location, say 'Paris'. For each, show their username, the comment_id, and the location of the comment's author.", "sql": null }, { "role": "assistant", "content": "SELECT l.user_id AS liker_us...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name...
[ { "role": "user", "content": "List the reference number and status for all applications that have at least one document associated with them.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT a.reference_number, a.status FROM government_services.applications AS a JOIN gover...
You are an expert in writing database language. You can write a corresponding 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": "List all maintenance logs where the mechanic's name is not recorded. Show the log ID, vehicle ID, service date, service type, and cost.", "sql": null }, { "role": "assistant", "content": "SELECT log_id, vehicle_id, service_date, service_type, cost FROM transport...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id uuid PRIMARY KEY, game_id uuid, server_name te...
[ { "role": "user", "content": "Show me the average number of current players for each server region.", "sql": null }, { "role": "assistant", "content": "SELECT region, AVG(current_players) AS average_players FROM gaming_technology.servers GROUP BY region;", "sql": null }, { "role"...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id tex...
[ { "role": "user", "content": "For each case type, calculate the average time to close cases in days, only including cases that have been closed.", "sql": null }, { "role": "assistant", "content": "SELECT case_type,\n AVG(EXTRACT(EPOCH FROM (date_closed - date_opened)) / 86400) AS avg_c...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text,...
[ { "role": "user", "content": "Find all pairs of citizens who share the same last name but have different dates of birth. Display both full names, the shared last name, and each date of birth.", "sql": null }, { "role": "assistant", "content": "SELECT\n c1.first_name || ' ' || c1.last_name 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 healthcare.medications ( medication_id character varying(64) NOT NULL, medication_na...
[ { "role": "user", "content": "List all combinations of manufacturers and generic names. For each combination, display the manufacturer, generic_name, and the number of medications.", "sql": null }, { "role": "assistant", "content": "SELECT manufacturer, generic_name, COUNT(*) AS medication_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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "Show each player with their player_id, username, the number of distinct in-game items they own, and the total quantity of those items.", "sql": null }, { "role": "assistant", "content": "```sql\nSELECT\n p.player_id,\n p.username,\n COUNT(DISTINCT i.item_id) ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at...
[ { "role": "user", "content": "How many users registered on each date?", "sql": null }, { "role": "assistant", "content": "SELECT DATE(created_at) AS registration_date, COUNT(*) AS user_count FROM web3.users GROUP BY DATE(created_at) ORDER BY registration_date;", "sql": null }, { ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id.text, patient_id.text, appointment_id.text, d...
[ { "role": "user", "content": "For each patient, find the date of their most recent medical record and the effective date of their current primary insurance plan. Return patient_id, last_record_date, and effective_date.", "sql": null }, { "role": "assistant", "content": "SELECT m.patient_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 government_services.services ( service_id text PRIMARY KEY, agency_id text, service_...
[ { "role": "user", "content": "Which agencies offer more than one type of service category? List the agency_id and the number of distinct categories they provide.", "sql": null }, { "role": "assistant", "content": "SELECT agency_id, COUNT(DISTINCT category) AS category_count FROM government_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 transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, o...
[ { "role": "user", "content": "Show me every unique combination of mechanic and service type that has performed maintenance, and the total number of such services per combination.", "sql": null }, { "role": "assistant", "content": "SELECT mechanic_name, service_type, COUNT(*) AS total_service...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid, username text, email text, password_hash...
[ { "role": "user", "content": "Retrieve the top 5 players by the number of distinct achievements unlocked. Show player_id and distinct_unlocks.", "sql": null }, { "role": "assistant", "content": "SELECT p.player_id, COUNT(DISTINCT pa.achievement_id) AS distinct_unlocks\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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, ...
[ { "role": "user", "content": "I need to get a list of all patients who had an appointment in the last 30 days, including patient ID, first and last name, appointment_time, and any associated diagnosis description.", "sql": null }, { "role": "assistant", "content": "SELECT p.patient_id,\n ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name charact...
[ { "role": "user", "content": "Show me the first and last names of all customers with policies having a premium amount greater than 3000, along with their policy number and policy status.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, p.policy_number, p....
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birt...
[ { "role": "user", "content": "List all insurance plans, showing their ID, name, provider, and plan type.", "sql": null }, { "role": "assistant", "content": "SELECT plan_id, plan_name, insurance_provider, plan_type FROM healthcare.insurance_plans;", "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 transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, ...
[ { "role": "user", "content": "List the vehicle_id, make, model, and acquisition_date for all active vehicles acquired after '2022-01-01'.", "sql": null }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, acquisition_date\nFROM transportation.vehicles\nWHERE status = 'Active...
You are an expert in writing database language. You can write a corresponding 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 payment records in USD including guest names and processing staff names.", "sql": null }, { "role": "assistant", "content": "SELECT p.payment_id,\n p.amount,\n p.currency_code,\n g.guest_name,\n s.staff_name\nFROM hospitality_technol...
You are an expert in writing database language. You can write a corresponding 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": "For each year since 2015, show the total number of games released per year.", "sql": null }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM release_date) AS year, COUNT(*) AS total_games\nFROM gaming_technology.games\nWHERE release_date >= '2015-01-...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "Show me all claims with police reports that were filed in the last 3 months, along with their policy details and estimated loss amounts.", "sql": null }, { "role": "assistant", "content": "SELECT cl.claim_id, cl.policy_id, cl.incident_date, cl.reported_date, cl....
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, a...
[ { "role": "user", "content": "Show me the metadata key and value for each asset where the key contains 'info', along with the asset name and symbol.", "sql": null }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, m.key, m.value\nFROM trading_platform.assets a\nJOIN 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 healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text...
[ { "role": "user", "content": "How many insurance policies does each patient have? Return patient_id and policy_count.", "sql": null }, { "role": "assistant", "content": "SELECT patient_id,\n COUNT(*) AS policy_count\nFROM healthcare.patient_insurance\nGROUP BY patient_id;", "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 healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, sp...
[ { "role": "user", "content": "Can you show me the number of unique doctors by specialty who were created after January 1st, 2024?", "sql": null }, { "role": "assistant", "content": "SELECT specialty, COUNT(DISTINCT doctor_id) AS doctor_count\nFROM healthcare.doctors\nWHERE created_at > '2024...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name charact...
[ { "role": "user", "content": "Calculate the average length of the description for each case_type.", "sql": null }, { "role": "assistant", "content": "SELECT case_type,\n AVG(LENGTH(description)) AS avg_desc_length\nFROM legal_services.cases\nGROUP 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 government_services.applications ( application_id text, citizen_id text, service_id ...
[ { "role": "user", "content": "For each application, show the application ID, the full name of the assigned employee, and the number of payments made for that application.", "sql": null }, { "role": "assistant", "content": "SELECT a.application_id, CONCAT(e.first_name, ' ', e.last_name) AS em...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the tok...
[ { "role": "user", "content": "What are the top 3 narratives by average USD purchase value per address (for buy transactions) across all chains?", "sql": null }, { "role": "assistant", "content": "SELECT narrative, AVG(usd_value::float / NULLIF(address_amount,0)) AS avg_usd_per_address\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 legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.tex...
[ { "role": "user", "content": "Show me all time entries, including the case name they are associated with.", "sql": null }, { "role": "assistant", "content": "SELECT T1.*, T2.case_name FROM time_entries AS T1 JOIN cases AS T2 ON T1.case_id = T2.case_id", "sql": null }, { "role": "...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text...
[ { "role": "user", "content": "List the product_id, product_name, and description of any insurance products created before 2024 whose description contains the word 'theft'.", "sql": null }, { "role": "assistant", "content": "SELECT product_id, product_name, description\nFROM insurance.insuran...
You are an expert in writing database language. You can write a corresponding 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": "I want to see for each account the total outgoing and incoming transaction amounts in the past 30 days.", "sql": null }, { "role": "assistant", "content": "SELECT t.account_id,\n SUM(CASE WHEN t.transaction_type = 'DEBIT' THEN t.amount ELSE 0 END) AS total...
You are an expert in writing database language. You can write a corresponding 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": "Compute the total invoiced amount and average payment delay (in days) by status for invoices issued between 2024-01-01 and 2024-06-30.", "sql": null }, { "role": "assistant", "content": "SELECT status,\n SUM(total_amount) AS total_invoiced,\n AVG(EXT...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id...
[ { "role": "user", "content": "我想查询所有检查结果为'Pass'的记录,包括检查类型、检查时间和检查备注,同时关联到对应的组件信息。", "sql": null }, { "role": "assistant", "content": "db.inspections.aggregate([\n {\n $match: {\n result: 'Pass'\n }\n },\n {\n $lookup: {\n from: 'components',\n localField: 'componen...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name te...
[ { "role": "user", "content": "Retrieve the driver_id, first_name, and last_name for all drivers whose license_expiry_date falls within the next 6 months from today.", "sql": null }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name\nFROM transportation.drivers\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 trading_platform.users ( user_id character varying(64) NOT NULL, username character ...
[ { "role": "user", "content": "List each user's username and the total number of trades they've participated in as buyers, including users who have not made any trades, sorted by the trade count descending.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, COUNT(t.trade_i...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi...
[ { "role": "user", "content": "For each contract deployed on network 'mainnet', show its address, status, the number of tokens created by that contract's address, and the total number of events emitted by that contract.", "sql": null }, { "role": "assistant", "content": "SELECT\n c.address 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 transportation.routes ( route_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "What is the average estimated_duration_minutes for each route type?", "sql": null }, { "role": "assistant", "content": "SELECT type, AVG(estimated_duration_minutes) AS avg_duration FROM transportation.routes GROUP BY type;", "sql": null }, { "role": ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "List all properties and the room types they offer, including the base rate for each room type.", "sql": null }, { "role": "assistant", "content": "SELECT T1.property_name, T2.type_name, T2.base_rate FROM hospitality_technology.properties AS T1 JOIN hospitality_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": "Find all applications whose last update occurred on a weekend. Show application_id, citizen full name, last_updated_at, and status.", "sql": null }, { "role": "assistant", "content": "SELECT\na.application_id,\n(c.first_name || ' ' || c.last_name) AS full_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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text...
[ { "role": "user", "content": "List all distinct asset types from the assets table.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT type\nFROM trading_platform.assets;", "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.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text,...
[ { "role": "user", "content": "Which five license states have the highest count of active agents? Return the license_state and agent_count.", "sql": null }, { "role": "assistant", "content": "SELECT license_state,\n COUNT(*) AS agent_count\nFROM insurance.agents\nWHERE status = 'Active'...
You are an expert in writing database language. You can write a corresponding 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": "Show me the trip_id, status, and passenger_count for all trips where the scheduled_departure and scheduled_arrival are on the same day, but the actual_arrival is later than the scheduled_arrival.", "sql": null }, { "role": "assistant", "content": "SELECT trip_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 financial_services.accounts ( account_id.text, customer_id.text, account_number.text...
[ { "role": "user", "content": "List all accounts opened in the last year. Show account_id, account_type, status, and opened_date.", "sql": null }, { "role": "assistant", "content": "SELECT account_id, account_type, status, opened_date FROM financial_services.accounts WHERE opened_date >= CURR...
You are an expert in writing database language. You can write a corresponding 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 PRIMARY KEY, address text, abi text, bytecode text...
[ { "role": "user", "content": "List all failed transactions along with the from and to addresses, and the gas used.", "sql": null }, { "role": "assistant", "content": "SELECT transaction_id, from_address, to_address, gas_used FROM web3.transactions WHERE status = 'failed';", "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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transacti...
[ { "role": "user", "content": "Show me the current ERC20 token balances for the wallet address '0x1A2b3C4dE5f6A7b8C9d0E1f2A3b4C5d6E7f8A9b0'.", "sql": null }, { "role": "assistant", "content": "SELECT contract_address, amount FROM erc20_balances WHERE wallet_address = '0x1A2b3C4dE5f6A7b8C9d0E1...
You are an expert in writing database language. You can write a corresponding 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": "How many documents has each lawyer uploaded? Return uploaded_by_lawyer_id and the count, only include lawyers with at least 3 documents, sorted by count descending.", "sql": null }, { "role": "assistant", "content": "SELECT uploaded_by_lawyer_id,\n COUNT(*...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character ...
[ { "role": "user", "content": "Get the number of log entries for each user where the action contains 'fail' in the last 30 days.", "sql": null }, { "role": "assistant", "content": "SELECT l.user_id, COUNT(*) AS fail_count\nFROM trading_platform.logs l\nWHERE l.action ILIKE '%fail%' AND l.logg...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text, claim_id text, document_type text, fil...
[ { "role": "user", "content": "For each claim, retrieve the document_id, file_name, and uploaded_at of the earliest and the latest uploaded document.", "sql": null }, { "role": "assistant", "content": "SELECT\n c1.claim_id,\n c1.document_id AS earliest_document_id,\n c1.file_name 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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birt...
[ { "role": "user", "content": "How many unique patient records are there for each gender?", "sql": null }, { "role": "assistant", "content": "SELECT gender, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patients GROUP BY gender;", "sql": null } ]
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Find all medical records associated with an appointment, and show the record_id, appointment_id, and the record_date.", "sql": null }, { "role": "assistant", "content": "SELECT record_id, appointment_id, record_date\nFROM healthcare.medical_records\nWHERE appoin...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE social_media.messages ( message_id text PRIMARY KEY, conversation_id text, sender_us...
[ { "role": "user", "content": "List the sender_user_id and the total number of messages they have sent that include media attachments, along with the conversation_id.", "sql": null }, { "role": "assistant", "content": "SELECT sender_user_id, conversation_id, COUNT(*) AS media_message_count\nF...
You are an expert in writing database language. You can write a corresponding 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": "List the total number of service orders placed by each staff member who delivered the service.", "sql": null }, { "role": "assistant", "content": "SELECT staff_id_delivered, COUNT(*) AS order_count FROM hospitality_technology.service_orders GROUP BY staff_id_del...
You are an expert in writing database language. You can write a corresponding 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": "For each medication manufacturer, show the total number of distinct generic names they produce.", "sql": null }, { "role": "assistant", "content": "SELECT manufacturer, COUNT(DISTINCT generic_name) AS distinct_generic_name_count FROM healthcare.medications WHERE...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name ...
[ { "role": "user", "content": "Show the application ID, payment amount, and payment method for all payments that have a status of 'Completed' and are related to services in the 'Licensing' category.", "sql": null }, { "role": "assistant", "content": "SELECT p.application_id, p.amount, p.payme...
You are an expert in writing database language. You can write a corresponding 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": "List all time entries where the description includes the word 'email', showing the entry ID, date worked, hours spent, and description.", "sql": null }, { "role": "assistant", "content": "SELECT entry_id, date_worked, hours_spent, description FROM legal_services...
You are an expert in writing database language. You can write a corresponding 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": "I want to see a list of followers and the usernames of the users they are following, along with when they followed.", "sql": null }, { "role": "assistant", "content": "SELECT u_f.username AS follower_username,\n u_t.username AS following_username,\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.reservations ( reservation_id text, property_id text, guest_i...
[ { "role": "user", "content": "Find pairs of reservations at the same property where the second check-in is within 7 days after the first check-out. Return first_reservation, second_reservation, and gap_days.", "sql": null }, { "role": "assistant", "content": "SELECT r1.reservation_id AS firs...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.reviews ( review_id text, property_id text, reservation_id te...
[ { "role": "user", "content": "Show me each staff member by response_staff_id and the number of unique guests whose reviews they have responded to.", "sql": null }, { "role": "assistant", "content": "SELECT response_staff_id, COUNT(DISTINCT guest_id) AS unique_guest_count\nFROM hospitality_te...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, da...
[ { "role": "user", "content": "Give me the number of active customers grouped by city.", "sql": null }, { "role": "assistant", "content": "SELECT city, COUNT(*) AS customer_count FROM financial_services.customers WHERE status = 'Active' GROUP BY city;", "sql": null }, { "role": "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 transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id ...
[ { "role": "user", "content": "List the log ID, vehicle ID, service date, and cost for all maintenance logs where the cost exceeds 2000 and the odometer reading is greater than 100,000.", "sql": null }, { "role": "assistant", "content": "SELECT log_id, vehicle_id, service_date, cost FROM tran...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE 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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi...
[ { "role": "user", "content": "For each token, show its token name, token symbol, the address of the contract it was created on, and the deployer address of that contract.", "sql": null }, { "role": "assistant", "content": "SELECT t.token_id, t.token_name, t.token_symbol, t.contract_address, ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_li...
[ { "role": "user", "content": "Show the property name, star rating, and number of rooms for each property.", "sql": null }, { "role": "assistant", "content": "SELECT p.property_name, p.star_rating, COUNT(r.room_id) AS room_count\nFROM hospitality_technology.properties p\nLEFT JOIN hospitality...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonc...
[ { "role": "user", "content": "Show me the block with the earliest timestamp and its corresponding previous block's difficulty level.", "sql": null }, { "role": "assistant", "content": "SELECT b1.block_id, b1.timestamp, b2.difficulty AS previous_block_difficulty\nFROM blockchain.blocks b1\nLE...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3...
[ { "role": "user", "content": "List all wallets holding the NFT with contract_address '0xabc123' and token_id '100' and the amount held.", "sql": null }, { "role": "assistant", "content": "SELECT wallet_address, amount\nFROM nft_holders\nWHERE contract_address = '0xabc123'\n AND token_id = '...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created...
[ { "role": "user", "content": "What is the total number of wallets recorded?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM web3.wallets;", "sql": null }, { "role": "user", "content": "Can you show me the number of wallets created on each distinct 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 healthcare.medical_records ( record_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Show me a list pairing each medication name with the record_id of any medical record whose treatment_plan mentions that medication.", "sql": null }, { "role": "assistant", "content": "SELECT m.medication_name, mr.record_id\nFROM healthcare.medications m\nJOIN he...
You are an expert in writing database language. You can write a corresponding 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 IDs and content of all posts that have at least one comment containing the word 'update', along with the full names of the commenters.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT p.post_id, p.content, u.full_name\nFROM 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 web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "Show all contracts deployed on 'testnet', including the contract_id, address, deployer_address, and deployed_at.", "sql": null }, { "role": "assistant", "content": "SELECT contract_id, address, deployer_address, deployed_at\nFROM web3.contracts\nWHERE network_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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name characte...
[ { "role": "user", "content": "How many prescriptions have been issued for each medication?", "sql": null }, { "role": "assistant", "content": "SELECT medication_id, COUNT(*) AS prescription_count FROM healthcare.prescriptions GROUP BY medication_id;", "sql": null }, { "role": "us...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, da...
[ { "role": "user", "content": "Retrieve all loans along with the corresponding customer's first and last name and the current principal balance.", "sql": null }, { "role": "assistant", "content": "SELECT l.loan_id, c.first_name, c.last_name, l.current_principal_balance\nFROM financial_service...