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 transportation.routes ( route_id text, route_number text, description text, origin_l...
[ { "role": "user", "content": "List all completed trips, showing the trip ID, the names of the origin and destination locations for the trip, and the actual arrival time.", "sql": null }, { "role": "assistant", "content": "SELECT t.trip_id, loc_origin.name AS origin_location_name, loc_dest.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.documents ( document_id.text, case_id.text, document_name.text, docum...
[ { "role": "user", "content": "Show me the count of documents uploaded by each lawyer. Display the uploader ID and the total count of documents.", "sql": null }, { "role": "assistant", "content": "SELECT uploaded_by_lawyer_id, COUNT(*) AS document_count FROM documents GROUP BY uploaded_by_law...
You are an expert in writing database language. You can write a corresponding 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": "Can you provide the mechanic name, service date, and service type for each maintenance log, along with the vehicle's odometer reading for all logs with a cost greater than 1000?", "sql": null }, { "role": "assistant", "content": "SELECT mechanic_name, service_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 government_services.citizens ( citizen_id text, national_id_number text, first_name ...
[ { "role": "user", "content": "For each notification sent through the 'SMS' channel, list the notification ID, message subject, and the full name of the citizen who received it.", "sql": null }, { "role": "assistant", "content": "SELECT n.notification_id, n.message_subject, c.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 token_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token t...
[ { "role": "user", "content": "Find tokens that are currently trending (trend rank 10 or lower) and have a positive net flow from smart money addresses. Show their token symbol, chain, trend rank, and smart money net flow. Order the results by trend rank ascending.", "sql": null }, { "role": "ass...
You are an expert in writing database language. You can write a corresponding 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": "Which accounts have executed trades with a total value greater than 1,000,000?", "sql": null }, { "role": "assistant", "content": "SELECT account_id, SUM(total_amount) AS total_traded_amount\nFROM financial_services.trades\nGROUP BY account_id\nHAVING SUM(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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "How many players are there for each status in the players table?", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS player_count\nFROM gaming_technology.players\nGROUP BY status;", "sql": null }, { "role": "user", "con...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "List the names of properties and the room number for every room at each property.", "sql": null }, { "role": "assistant", "content": "SELECT T1.property_name , T2.room_number FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.rooms AS T2 O...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_na...
[ { "role": "user", "content": "Can you give me a list of all invoices issued in 2024, along with the invoice number, client full name, case number, and total amount?", "sql": null }, { "role": "assistant", "content": "SELECT i.invoice_number, cl.first_name || ' ' || cl.last_name AS client_ful...
You are an expert in writing database language. You can write a corresponding 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": "Could you list all pairs of active accounts for the same customer, showing customer_id, account_a, and account_b?", "sql": null }, { "role": "assistant", "content": "SELECT a.customer_id, a.account_number AS account_a, b.account_number AS account_b FROM financia...
You are an expert in writing database language. You can write a corresponding 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 the total number of time entries marked as billable in the system.", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) AS total_billable_time_entries\nFROM legal_services.time_entries\nWHERE is_billable = TRUE;", "sql": null } ]
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number...
[ { "role": "user", "content": "Show me the names of all law firms and the total number of lawyers associated with each firm.", "sql": null }, { "role": "assistant", "content": "SELECT T1.firm_name, count(T2.lawyer_id) FROM legal_services.law_firms AS T1 JOIN legal_services.lawyers AS T2 ON 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 web3.tokens ( token_id text, contract_address text, token_name text, token_symbol te...
[ { "role": "user", "content": "Show me the token names and their contract addresses where the total supply is greater than 1 million, sorted by total supply in descending order.", "sql": null }, { "role": "assistant", "content": "SELECT token_name, contract_address FROM web3.tokens WHERE tota...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE 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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_nam...
[ { "role": "user", "content": "Which project raised the highest investment_value in each fundraising round?", "sql": null }, { "role": "assistant", "content": "SELECT p.project_name, p.rounds_name, p.investment_value AS max_investment\nFROM project_fundraising_record p\nJOIN (\n SELECT rou...
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT NULL, agency_id ...
[ { "role": "user", "content": "Which employees have verified more than 5 documents in the last 30 days? Return the employee's full name, department, and the number of verifications.", "sql": null }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.last_name AS full_name, e.d...
You are an expert in writing database language. You can write a corresponding 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.dapps ( dapp_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "List the names of all DApps whose description contains the word 'auction' along with the user IDs of anyone who has had a KYC audit.", "sql": null }, { "role": "assistant", "content": "SELECT d.name AS dapp_name, k.user_id\nFROM trading_platform.dapps d\nJOIN tr...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "List appointment IDs, patient first and last names, and their chief complaint for appointments that have an associated medical record.", "sql": null }, { "role": "assistant", "content": "SELECT a.appointment_id, p.first_name, p.last_name, mr.chief_complaint\nFRO...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text,...
[ { "role": "user", "content": "Retrieve the vehicle_id, make, model, and the next_service_due_date for each vehicle based on the most recent maintenance log.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT ON (ml.vehicle_id) v.vehicle_id, v.make, v.model, ml.next_service_d...
You are an expert in writing database language. You can write a corresponding 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": "List all top-level comments, showing their ID, post ID, user ID, and content.", "sql": null }, { "role": "assistant", "content": "SELECT comment_id, post_id, user_id, content FROM social_media.comments WHERE parent_comment_id 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 healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NU...
[ { "role": "user", "content": "Which patients have insurance policies that are effective between May 1st, 2023 and October 1st, 2023? Show their patient_id, policy_number, and effective_date, and also include the related plan_id.", "sql": null }, { "role": "assistant", "content": "SELECT pati...
You are an expert in writing database language. You can write a corresponding 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": "List customers who have active 'Auto' policies, showing their first name, last name, the policy number, and the product name.", "sql": null }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.policy_number, T3.product_name FROM insurance...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "Show me all users along with the total number of unique hashtags used in their posts.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(DISTINCT ph.hashtag_id) AS unique_hashtag_count\nFROM social_media.users u\nLEFT JOIN so...
You are an expert in writing database language. You can write a corresponding 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 ...
[ { "role": "user", "content": "List the top 5 tokens by liquidity on the Ethereum chain. Show token_symbol, liquidity, and price.", "sql": null }, { "role": "assistant", "content": "SELECT token_symbol, liquidity, price\nFROM token_dexpool_info\nWHERE chain = 'Ethereum'\nORDER BY liquidity DE...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -...
[ { "role": "user", "content": "Show me the count of game servers available for each game platform. Include the platform name and the server count.", "sql": null }, { "role": "assistant", "content": "SELECT g.platform, COUNT(s.server_id) AS server_count FROM gaming_technology.servers AS s JOIN...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, produ...
[ { "role": "user", "content": "Show me product_id, product_name, and base_premium for products created after '2023-01-01'.", "sql": null }, { "role": "assistant", "content": "SELECT product_id,\n product_name,\n base_premium\nFROM insurance.insurance_products\nWHERE created_at > '...
You are an expert in writing database language. You can write a corresponding 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": "Calculate the total sum of hours spent across all time entries that are billable but have not yet been billed.", "sql": null }, { "role": "assistant", "content": "SELECT SUM(hours_spent) FROM legal_services.time_entries WHERE is_billable = TRUE AND is_billed = F...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id tex...
[ { "role": "user", "content": "Show the total amount of payments processed by each payment_method.", "sql": null }, { "role": "assistant", "content": "SELECT payment_method,\n SUM(amount) AS total_amount\nFROM hospitality_technology.payments\nGROUP BY payment_method;", "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_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, ...
[ { "role": "user", "content": "For each player, show their username and the total quantity of items they own in their inventory, alongside the total number of game sessions they have played.", "sql": null }, { "role": "assistant", "content": "SELECT T1.username, COALESCE(T2.total_item_quantit...
You are an expert in writing database language. You can write a corresponding 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 commented on a post and have also liked any comment on that same post. I want their user IDs and the corresponding post IDs.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT c.user_id, c.post_id\nFROM social_media.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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text,...
[ { "role": "user", "content": "List the names of service locations and categories of active services offered by the same agency.", "sql": null }, { "role": "assistant", "content": "SELECT sl.location_name, s.category\nFROM government_services.service_locations AS sl\nJOIN government_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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number...
[ { "role": "user", "content": "Show me the full names of partners and the full names of non-partner lawyers at the same firm.", "sql": null }, { "role": "assistant", "content": "SELECT p.first_name || ' ' || p.last_name AS partner_full_name, np.first_name || ' ' || np.last_name AS lawyer_full...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "For each reservation, show the reservation ID and the total number of payments made for that reservation.", "sql": null }, { "role": "assistant", "content": "SELECT\n r.reservation_id,\n COUNT(p.payment_id) AS payment_count\nFROM hospitality_technology.reserva...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,...
[ { "role": "user", "content": "For each ERC1155 NFT contract on Ethereum, show the contract address, token_id, and the total amount held across all wallets.", "sql": null }, { "role": "assistant", "content": "SELECT nh.contract_address, nh.token_id, SUM(CAST(nh.amount AS NUMERIC)) AS total_am...
You are an expert in writing database language. You can write a corresponding 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 created in 2024, showing the group_name, conversation_id, and creation time.", "sql": null }, { "role": "assistant", "content": "SELECT conversation_id, group_name, created_at\nFROM social_media.conversations\nWHERE is_group_chat = true AND ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_a...
[ { "role": "user", "content": "Show all token transfers where the token was created by a contract with status 'active'. Include transfer ID, token symbol, value, and the contract address.", "sql": null }, { "role": "assistant", "content": "SELECT tt.transfer_id, tk.token_symbol, tt.value, tk....
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, applicat...
[ { "role": "user", "content": "How many documents were uploaded in the year 2023?", "sql": null }, { "role": "assistant", "content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;", "sql": null } ]
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.t...
[ { "role": "user", "content": "How many insurance policies does each subscriber have? Please display the subscriber name and policy count.", "sql": null }, { "role": "assistant", "content": "SELECT subscriber_name, COUNT(*) AS policy_count FROM healthcare.patient_insurance GROUP BY subscriber...
You are an expert in writing database language. You can write a corresponding 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": "List the full names and contact email of agents whose agency name contains 'Insurance'.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, contact_email FROM insurance.agents WHERE agency_name LIKE '%Insurance%'", "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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character...
[ { "role": "user", "content": "For each fundraising round in 2022 and 2023, list the round name, the year, the total investment_value, and the count of distinct projects. Also include the average market_cap of associated tokens by matching project_name to token_symbol in token_basic_info.", "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.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "Which room types have a base rate above 250, and what are their property names and maximum occupancy?", "sql": null }, { "role": "assistant", "content": "SELECT rt.room_type_id, rt.type_name, p.property_name, rt.base_rate, rt.max_occupancy\nFROM hospitality_tech...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.t...
[ { "role": "user", "content": "For each user, show their user ID and the count of unique wallet addresses they own.", "sql": null }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT address) FROM wallets GROUP BY user_id;", "sql": null } ]
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text...
[ { "role": "user", "content": "Show the license numbers and full names of all doctors who were registered before January 1, 2020 and work at 'hospital_789'.", "sql": null }, { "role": "assistant", "content": "SELECT license_number, first_name, last_name FROM healthcare.doctors WHERE created_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.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text,...
[ { "role": "user", "content": "For each passenger, show their passenger_id, first_name, last_name, the date and time of their earliest booking, and the date and time of their latest booking.", "sql": null }, { "role": "assistant", "content": "SELECT p.passenger_id,\n p.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 web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_a...
[ { "role": "user", "content": "List the transaction IDs that have both an event and a token transfer, along with the name of the event and the value of the token transfer.", "sql": null }, { "role": "assistant", "content": "SELECT T1.transaction_id, T1.event_name, T2.value FROM web3.events 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.agencies ( agency_id.text, agency_name.text, jurisdiction_level....
[ { "role": "user", "content": "Show me all agencies established after 2020 and their jurisdiction level.", "sql": null }, { "role": "assistant", "content": "SELECT agency_id, agency_name, jurisdiction_level, established_date\nFROM government_services.agencies\nWHERE established_date > '2020-1...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_num...
[ { "role": "user", "content": "List pairs of bookings made for the same trip, showing booking IDs and their booking_time.", "sql": null }, { "role": "assistant", "content": "SELECT b1.booking_id AS booking1,\n b2.booking_id AS booking2,\n b1.trip_id,\n b1.booking_time AS tim...
You are an expert in writing database language. You can write a corresponding 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 me a list of patients along with their latest prescription's medication name, prescription date, and the prescribing doctor's ID.", "sql": null }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pr.medication_id, m.medicat...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "Find all customers who have at least two active policies with overlapping coverage periods. List the customer ID and the policy numbers of any two such overlapping active policies.", "sql": null }, { "role": "assistant", "content": "SELECT\n p1.customer_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.insurance_products ( product_id text PRIMARY KEY, product_name text, produ...
[ { "role": "user", "content": "Get the number of insurance products grouped by product_type and their active status. Return product_type, is_active, and the count of products.", "sql": null }, { "role": "assistant", "content": "SELECT product_type, is_active, COUNT(*) AS product_count\nFROM 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 character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "Which users joined conversations that are NOT group chats after May 1, 2024? Return their usernames and the conversation IDs.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, cp.conversation_id\nFROM social_media.conversation_participants 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 legal_services.clients ( client_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Find all clients who do not have a company name listed and show their full name and email.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE company_name 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 gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id ...
[ { "role": "user", "content": "Which games have the highest average item cost for Legendary rarity items? Please show the game title, genre, and the average cost of those items.", "sql": null }, { "role": "assistant", "content": "SELECT g.title, g.genre, AVG(igi.cost_amount) AS avg_legendary_...
You are an expert in writing database language. You can write a corresponding 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 trip, list the trip_id, the passenger_count from trips, the number of bookings for that trip, and the average fare of those bookings.", "sql": null }, { "role": "assistant", "content": "SELECT t.trip_id, t.passenger_count, COUNT(b.booking_id) AS booking...
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT NULL, -- uniq...
[ { "role": "user", "content": "For each customer, show the number of open accounts and their combined balance, joining the accounts table with itself on customer_id for demonstration.", "sql": null }, { "role": "assistant", "content": "SELECT a.customer_id, COUNT(a.account_id) AS open_account...
You are an expert in writing database language. You can write a corresponding 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": "Find users who have at least one wallet created before their user registration date. List their username and the address of any such wallet.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, w.address AS wallet_address FROM web3.users AS u J...
You are an expert in writing database language. You can write a corresponding 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": "List all policies sold by agents licensed in Texas. Include the policy number, policy start date, and the agent's first and last name.", "sql": null }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.start_date, T2.first_name, T2.last_name FROM in...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id tex...
[ { "role": "user", "content": "Show me all cases with a status of 'Pending', displaying their case name and court jurisdiction.", "sql": null }, { "role": "assistant", "content": "SELECT case_name, court_jurisdiction FROM legal_services.cases WHERE status = 'Pending';", "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.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, ser...
[ { "role": "user", "content": "What is the total session duration and total score across all sessions for each server status?", "sql": null }, { "role": "assistant", "content": "SELECT\n s.status,\n SUM(gs.duration_seconds) AS total_duration_seconds,\n SUM(gs.score) AS total_score\nFROM ga...
You are an expert in writing database language. You can write a corresponding 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": "Give me the booking_id, passenger_id, trip_id, and special_requests for bookings that have any special_requests.", "sql": null }, { "role": "assistant", "content": "SELECT booking_id, passenger_id, trip_id, special_requests\nFROM transportation.bookings\nWHERE 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.customers ( customer_id text, first_name text, last_name text, da...
[ { "role": "user", "content": "Show me the average high price and average low price for each security sector using market data.", "sql": null }, { "role": "assistant", "content": "SELECT T1.sector, AVG(T2.high_price) AS average_high_price, AVG(T2.low_price) AS average_low_price FROM financial...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdi...
[ { "role": "user", "content": "For each agency, list the agency name and the total count of employees who have a recorded termination date.", "sql": null }, { "role": "assistant", "content": "SELECT a.agency_name, COUNT(e.employee_id) FROM government_services.agencies AS a LEFT JOIN 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 transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, dri...
[ { "role": "user", "content": "List all trips along with their trip ID and the number of passengers if the trip is currently in progress.", "sql": null }, { "role": "assistant", "content": "SELECT trip_id, passenger_count FROM transportation.trips WHERE status = 'In Progress';", "sql": nu...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id character varying(64) NOT NULL, acc...
[ { "role": "user", "content": "Show me all transactions with a status of 'FAILED' that occurred within the last 7 days.", "sql": null }, { "role": "assistant", "content": "SELECT * FROM financial_services.transactions WHERE status = 'FAILED' AND transaction_date >= NOW() - INTERVAL '7 day';",...
You are an expert in writing database language. You can write a corresponding 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 NOT NULL DEFAULT gen_random_uuid(), title cha...
[ { "role": "user", "content": "Show me all achievements with their name and the total number of players who have unlocked each achievement.", "sql": null }, { "role": "assistant", "content": "SELECT a.achievement_id, a.name, COUNT(pa.player_id) AS players_unlocked\nFROM gaming_technology.achi...
You are an expert in writing database language. You can write a corresponding 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": "What is the average commission rate for active agents?", "sql": null }, { "role": "assistant", "content": "SELECT AVG(commission_rate) FROM insurance.agents WHERE status = 'Active';", "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.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "List all rooms with their numbers, property names, and the full name of the property manager.", "sql": null }, { "role": "assistant", "content": "SELECT r.room_number, p.property_name, s.first_name || ' ' || s.last_name AS manager_full_name\nFROM hospitality_tec...
You are an expert in writing database language. You can write a corresponding 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": "Can you narrow this down to only show cases where the case type is 'Criminal'?", "sql": null }, { "role": "assistant", "content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND ca...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.employees ( employee_id.text, agency_id.text, first_name.text, l...
[ { "role": "user", "content": "For each access level, count the number of employees. Return access_level and the corresponding employee_count.", "sql": null }, { "role": "assistant", "content": "SELECT access_level, COUNT(*) AS employee_count FROM government_services.employees GROUP BY access...
You are an expert in writing database language. You can write a corresponding 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": "List the object ID, collection type, and owner for all Sui NFTs with status 'exists'.", "sql": null }, { "role": "assistant", "content": "SELECT object_id, collection_type, owner FROM sui_nfts WHERE status = 'exists';", "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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.t...
[ { "role": "user", "content": "Show the number of wallets created each month in 2024, showing the year and month.", "sql": null }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM created_at) AS year, EXTRACT(MONTH FROM created_at) AS month, COUNT(*) FROM wallets WHERE EXTRACT(YEAR...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id.text, firm_name.text, address.text, phone.text, w...
[ { "role": "user", "content": "Show me law firms that were founded after 2018 and have a website provided.", "sql": null }, { "role": "assistant", "content": "SELECT firm_name, founded_date, website\nFROM legal_services.law_firms\nWHERE founded_date > '2018-12-31' AND website IS NOT NULL AND ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_work...
[ { "role": "user", "content": "Find pairs of time entries for the same invoice where one entry is billed and the other is not.", "sql": null }, { "role": "assistant", "content": "SELECT a.invoice_id,\n a.entry_id AS billed_entry,\n b.entry_id AS unbilled_entry\nFROM 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 hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL,...
[ { "role": "user", "content": "List properties and the average base rate of their room types.", "sql": null }, { "role": "assistant", "content": "SELECT T1.property_name , AVG(T2.base_rate) FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room_types AS T2 ON T1.proper...
You are an expert in writing database language. You can write a corresponding 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": "Show me the first and last names of citizens along with their dates of birth and contact emails for all citizens who registered after January 1, 2023.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth, contact_email ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_work...
[ { "role": "user", "content": "List all invoices with a total_amount less than 1000 and show the associated client's ID and case ID.", "sql": null }, { "role": "assistant", "content": "SELECT invoice_id, client_id, case_id, total_amount\nFROM legal_services.invoices\nWHERE total_amount < 1000...
You are an expert in writing database language. You can write a corresponding 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": "What is the total count of medical records created in the year 2023 where the assessment field is not empty?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM healthcare.medical_records mr WHERE (mr.assessment IS NOT NULL AND mr.assessment...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "List all insurance products with a base premium less than 500, ordered by base premium ascending. Show product name, product type, and base premium.", "sql": null }, { "role": "assistant", "content": "SELECT product_name, product_type, base_premium FROM insuranc...
You are an expert in writing database language. You can write a corresponding 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": "Show the IDs and registration dates of all verified citizens who could be eligible for at least one active service. Display the citizen ID and registration date.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT c.citizen_id, c.registration_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 web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "Count the number of contracts per network and status.", "sql": null }, { "role": "assistant", "content": "SELECT\n network_id,\n status,\n COUNT(*) AS contract_count\nFROM web3.contracts\nGROUP BY network_id, status;", "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 cex_token_balance ( snapshot_time.text, chain.text, address.text, exchange.text, tok...
[ { "role": "user", "content": "What is the total USD value of tokens held by each exchange on Ethereum and Polygon chains in the latest snapshot? Please show exchange, chain, and total usd_value.", "sql": null }, { "role": "assistant", "content": "WITH latest_snapshot AS (\n SELECT MAX(snaps...
You are an expert in writing database language. You can write a corresponding 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": "I need a list of customers who have filed at least one claim, along with the count of their claims and the total estimated loss per customer.", "sql": null }, { "role": "assistant", "content": "SELECT c.customer_id,\n COUNT(cl.claim_id) AS claim_count,\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 trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, a...
[ { "role": "user", "content": "Show me the total count and sum of amounts for spent and unspent UTXOs for each asset, including the asset name and symbol.", "sql": null }, { "role": "assistant", "content": "SELECT a.asset_id, a.name AS asset_name, a.symbol, u.spent, COUNT(*) AS utxo_count, SU...
You are an expert in writing database language. You can write a corresponding 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": "Find pairs of routes where the destination of one route matches the origin of another. Show the first_route_number, first_description, second_route_number, and second_description.", "sql": null }, { "role": "assistant", "content": "SELECT r1.route_number 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.services ( service_id.text, property_id.text, service_name.te...
[ { "role": "user", "content": "Calculate the average price for services within each category.", "sql": null }, { "role": "assistant", "content": "SELECT category, AVG(price) FROM hospitality_technology.services GROUP BY category;", "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 financial_services.accounts ( account_id.text, customer_id.text, account_number.text...
[ { "role": "user", "content": "Show me the total principal_amount of all loans for each loan_type.", "sql": null }, { "role": "assistant", "content": "SELECT loan_type, SUM(principal_amount) AS total_principal\nFROM financial_services.loans\nGROUP BY loan_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.citizens ( citizen_id character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "Show me the first and last names of citizens and the number of appointments they have scheduled with the employee whose last name is 'Smith'.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(a.appointment_id) AS appoint...
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT NULL, customer_id...
[ { "role": "user", "content": "For each loan, show the loan ID, principal amount, interest rate, and the balance and currency of the associated account.", "sql": null }, { "role": "assistant", "content": "SELECT l.loan_id, l.principal_amount, l.interest_rate, a.balance, a.currency FROM financ...
You are an expert in writing database language. You can write a corresponding 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": "List public reviews whose comment contains the word 'slow'.", "sql": null }, { "role": "assistant", "content": "SELECT review_id, comment, review_date, rating_overall, property_id FROM hospitality_technology.reviews WHERE is_public = TRUE AND LOWER(comment) LIKE...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "Show me the usernames and registration dates for players who registered between '2023-01-01' and '2023-12-31'.", "sql": null }, { "role": "assistant", "content": "SELECT username, registration_date FROM gaming_technology.players WHERE registration_date >= '2023-...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "Count the number of customers grouped by their status.", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM insurance.customers GROUP BY status;", "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.appointments ( appointment_id text, citizen_id text, employee_id...
[ { "role": "user", "content": "For each location, count the total number of appointments scheduled. Show the location name and the count.", "sql": null }, { "role": "assistant", "content": "SELECT T2.location_name, COUNT(T1.appointment_id) FROM government_services.appointments AS T1 JOIN loca...
You are an expert in writing database language. You can write a corresponding 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 // Node Label: :Platform // Properties: // platform_id: String (Constraint: UNIQUE) // platfo...
[ { "role": "user", "content": "Can you provide the total number of maintenance records for a specific train with train_id 'train_789'?", "sql": null }, { "role": "assistant", "content": "MATCH (t:Train {train_id: 'train_789'})<-[:PERFORMED_ON]-(mr:MaintenanceRecord)\nRETURN COUNT(mr) 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 narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeri...
[ { "role": "user", "content": "Show the top 5 narratives by 24h volume, displaying narrative and volume_24h.", "sql": null }, { "role": "assistant", "content": "SELECT narrative, volume_24h FROM narrative_info ORDER BY volume_24h DESC LIMIT 5;", "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.players ( player_id.uuid, username.text, email.text, password_hash...
[ { "role": "user", "content": "Which players have played sessions on more than one distinct game? Show their player_id, username, and the number of unique games they've played.", "sql": null }, { "role": "assistant", "content": "SELECT p.player_id, p.username, COUNT(DISTINCT gs.game_id) AS un...
You are an expert in writing database language. You can write a corresponding 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": "I need to get the count of appointments grouped by their status.", "sql": null }, { "role": "assistant", "content": "SELECT a.status, \n COUNT(*) AS appointment_count\nFROM legal_services.appointments a\nGROUP BY a.status;", "sql": null }, { "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 that have 'follow-up' mentioned in the notes field.", "sql": null }, { "role": "assistant", "content": "SELECT * FROM healthcare.appointments WHERE notes LIKE '%follow-up%';", "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, patient_id ch...
[ { "role": "user", "content": "For each patient, count the total number of medical records they have in the system, and show patient_id along with record_count.", "sql": null }, { "role": "assistant", "content": "SELECT patient_id,\n COUNT(*) AS record_count\nFROM healthcare.medical_rec...
You are an expert in writing database language. You can write a corresponding 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": "Show me the total hours spent by each lawyer on a specific case, say with case_id = 'CASE001'.", "sql": null }, { "role": "assistant", "content": "SELECT lawyer_id, SUM(hours_spent) AS total_hours FROM legal_services.time_entries WHERE case_id = 'CASE001' GROUP ...