system
stringlengths
333
7.66k
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 train_station_management.train_cars ( car_id character varying(64) NOT NULL, -- ...
[ { "role": "user", "content": "Can you help me get the total number of passenger cars for each train car type in the database?" }, { "role": "assistant", "content": "SELECT car_type, COUNT(*) as total_cars\nFROM train_station_management.train_cars\nWHERE car_type = 'Passenger'\nGROUP BY car_type;...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name charact...
[ { "role": "user", "content": "List each claim with its policy number and the selling agent's first and last name." }, { "role": "assistant", "content": "SELECT c.claim_id, p.policy_number, a.first_name, a.last_name\nFROM insurance.claims c\nJOIN insurance.policies p ON c.policy_id = p.policy_id\...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Show me all appointments along with the subject, the appointment's start time, and the full name of the client associated with each appointment." }, { "role": "assistant", "content": "SELECT a.subject, a.start_time, c.first_name, c.last_name FROM legal_services.appo...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Show me a list of all partners who were hired in 2021." }, { "role": "assistant", "content": "SELECT lawyer_id,\n first_name,\n last_name,\n hire_date\nFROM legal_services.lawyers\nWHERE is_partner = true\n AND hire_date BETWEEN '2021-01-01' 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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "For each agent, show the total number of policies they have sold and the sum of the premium amounts. Include the agent_id." }, { "role": "assistant", "content": "SELECT agent_id, COUNT(*) AS policy_count, SUM(premium_amount) AS total_premium\nFROM insurance.policies...
You are an expert in writing database language. You can write a corresponding 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": "Show the total number of documents uploaded for each lawyer. Display the lawyer's first and last name and the document count." }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, COUNT(d.document_id) AS document_count\nFROM legal_services.lawyers...
You are an expert in writing database language and you can refuse the user's question if the question is not related to the table structure. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREA...
[ { "role": "user", "content": "What is the current salary of employee with ID 'EMP123'?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about an employee's salary as it is not included in the data available in the 'employees' table." } ]
You are an expert in writing database language. You can write a corresponding 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 replacement policies where a customer received a new policy starting the day after their previous policy was cancelled. Return customer_id, original_policy_id, original_cancellation_date, new_policy_id, new_start_date." }, { "role": "assistant", "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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name charac...
[ { "role": "user", "content": "Find all invoices that are currently overdue. Include the invoice number, due date, total amount, and the client's name." }, { "role": "assistant", "content": "SELECT i.invoice_number, i.due_date, i.total_amount, c.first_name, c.last_name FROM legal_services.invoice...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "List all documents uploaded for cases handled in the 'District Court' jurisdiction, showing the document name, case number, and upload timestamp." }, { "role": "assistant", "content": "SELECT d.document_name, cs.case_number, d.upload_timestamp\nFROM legal_services.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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "List all room types that have at least one service in the 'Spa' category, including the room type name, property name, and service name." }, { "role": "assistant", "content": "SELECT DISTINCT rt.type_name, p.property_name, s.service_name\nFROM hospitality_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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "Show me the top 3 countries by total number of registered guests. Include country_code and guest_count." }, { "role": "assistant", "content": "SELECT g.country_code, COUNT(*) AS guest_count\nFROM hospitality_technology.guests g\nGROUP BY g.country_code\nORDER BY gue...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "List the full name (first name and last name) and position of all staff members working at properties located in 'California'. Include the name of the property they work at." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.position, T2.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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "Get the average overall review rating for each property. Return property_name and avg_rating." }, { "role": "assistant", "content": "SELECT pr.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.reviews r\nJOIN hospitality_technology.prop...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "List all reservations along with the guest's full name and the property name for reservations made in properties outside the USA." }, { "role": "assistant", "content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS guest_full_name, p.property_name\n...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_li...
[ { "role": "user", "content": "Show me the payment amount and the name of the property associated with each payment record." }, { "role": "assistant", "content": "SELECT\n p.amount,\n prop.property_name\nFROM hospitality_technology.payments AS p\nJOIN hospitality_technology.reservations AS r ON...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "Show me all service orders with their order ID, guest ID, reservation ID, and the name of the property where the order was made." }, { "role": "assistant", "content": "SELECT so.order_id, so.guest_id, so.reservation_id, p.property_name\nFROM hospitality_technology.s...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "List the names of services and the total number of times each service has been ordered. Only include services that have been ordered at least once." }, { "role": "assistant", "content": "SELECT T1.service_name, count(T2.order_id) AS order_count FROM 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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Retrieve the guest_id, first_name, last_name, and loyalty_member_id for all guests who have communication_consent enabled." }, { "role": "assistant", "content": "SELECT guest_id, first_name, last_name, loyalty_member_id\nFROM hospitality_technology.guests\nWHERE com...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "List all available rooms with their room number, property_name, type_name, and the number of days since they were last cleaned." }, { "role": "assistant", "content": "SELECT p.property_name,\n r.room_number,\n rt.type_name,\n date_part('day', curre...
You are an expert in writing database language. You can write a corresponding 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": "List all projects that raised funds in March 2023. For each project, show its name, amount raised, fundraising round, and the token symbol and price of its associated token." }, { "role": "assistant", "content": "SELECT p.project_name, p.investment_value, p.rounds_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 token_basic_info ( coin_id text, token_name text, token_symbol text, token_address t...
[ { "role": "user", "content": "Find tokens on the 'Polygon' chain with a market cap greater than $1,000,000,000 and a positive price change in the last 24 hours. List their symbol, name, market cap, and 24h price change." }, { "role": "assistant", "content": "SELECT token_symbol, token_name, mark...
You are an expert in writing database language. You can write a corresponding 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_performance ( token_address character varying(100) NOT NULL, token...
[ { "role": "user", "content": "Show the tokens with a negative net flow this month on all chains." }, { "role": "assistant", "content": "SELECT token_symbol, chain, net_flow FROM smart_money_token_performance WHERE net_flow < 0 AND date_trunc('month', CURRENT_DATE) = date_trunc('month', now());" ...
You are an expert in writing database language. You can write a corresponding 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": "Show me the top 3 tokens with the highest 7-day price change percentage. Display their symbol, chain, and 7d price change." }, { "role": "assistant", "content": "SELECT token_symbol, chain, price_change_percentage_7d\nFROM token_basic_info\nORDER BY price_change_per...
You are an expert in writing database language. You can write a corresponding 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_performance ( token_address.text, token_symbol.text, pnl.numeric, ...
[ { "role": "user", "content": "List all smart money addresses that have a negative PNL but a positive Realized Ratio. Show the address, chain, PNL, and Realized Ratio." }, { "role": "assistant", "content": "SELECT token_address, chain, pnl, realized_ratio FROM smart_money_token_performance 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 token_dexpool_info ( pair_address character varying(512) NOT NULL, token_name charac...
[ { "role": "user", "content": "Show me the top 5 tokens by 24-hour trading volume on the Ethereum chain, along with their price and 24-hour price change percentage." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, price, price_change_percentage_24h, volume_24h FROM token_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 smart_money_profit ( address text, rank numeric, profit numeric, roi numeric, realiz...
[ { "role": "user", "content": "For each chain, show the total number of smart money addresses and the count of addresses with positive profit." }, { "role": "assistant", "content": "SELECT chain, COUNT(address) AS total_addresses, COUNT(CASE WHEN profit > 0 THEN address END) AS positive_profit_ad...
You are an expert in writing database language. You can write a corresponding 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_profit ( address text, rank numeric, profit numeric, roi numeric, realiz...
[ { "role": "user", "content": "Which are the top 5 smart money addresses with the highest ROI on the BSC chain, and what are their profit, realized ratio, and most profitable token?" }, { "role": "assistant", "content": "SELECT address, profit, roi, realized_ratio, most_profit_token FROM smart_mo...
You are an expert in writing database language. You can write a corresponding 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_performance ( token_address.text, token_symbol.text, pnl.numeric, ...
[ { "role": "user", "content": "List token symbols on any chain that have both a realized ratio above 0.8 and an ROI greater than 5. Show their symbol, chain, realized ratio, and ROI." }, { "role": "assistant", "content": "SELECT token_symbol, chain, realized_ratio, roi FROM smart_money_token_perf...
You are an expert in writing database language. You can write a corresponding 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_profit ( address.text, rank.numeric, profit.numeric, roi.numeric, realiz...
[ { "role": "user", "content": "How many addresses have a realized_ratio below 0.5?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE realized_ratio < 0.5;" } ]
You are an expert in writing database language. You can write a corresponding 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": "For each customer, find pairs of policies where one policy’s premium is at least $5000 higher than the other. Show customer_id, lower_premium_policy_id, higher_premium_policy_id, and the premium_difference." }, { "role": "assistant", "content": "SELECT p1.customer_i...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id.text, record_id.text, patient_id.text, do...
[ { "role": "user", "content": "Find pairs of prescriptions for the same patient with overlapping periods. Show p1.prescription_id, p2.prescription_id, patient_id, and the overlap duration in days where the overlap is greater than 15 days." }, { "role": "assistant", "content": "SELECT p1.prescript...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, ...
[ { "role": "user", "content": "List policy pairs for the same customer where one policy was cancelled and another active policy started within 30 days after the cancellation. Show customer_id, cancelled policy_number, cancellation_date, active policy_number, start_date." }, { "role": "assistant", ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "Show me all pairs of active policies for the same customer where their coverage periods overlap. Return customer_id, policy1_id, policy2_id, overlap_start, overlap_end." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_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 transportation.passengers ( passenger_id character varying(64) NOT NULL, first_name ...
[ { "role": "user", "content": "For each passenger, show their passenger_id, first_name, last_name, and the count of other passengers in the same loyalty_program_id." }, { "role": "assistant", "content": "SELECT p1.passenger_id, p1.first_name, p1.last_name, COUNT(p2.passenger_id) AS peer_count\nFR...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, produ...
[ { "role": "user", "content": "List all pairs of insurance products that share the same product_type but have differing active statuses. Return both product_ids, the product_type, and each is_active flag." }, { "role": "assistant", "content": "SELECT p1.product_id AS product_id_1, p2.product_id A...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), usern...
[ { "role": "user", "content": "Find pairs of players from the same country who have different last login dates. Show their usernames, country code, and last login dates. Exclude pairs where either last login date is null." }, { "role": "assistant", "content": "SELECT p1.username AS player1_userna...
You are an expert in writing database language. You can write a corresponding 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 character varying(64) NOT NULL, --...
[ { "role": "user", "content": "List all reservations that have made multiple payment transactions. Return reservation_id and payment_id for each occurrence." }, { "role": "assistant", "content": "SELECT DISTINCT p1.reservation_id, p1.payment_id\nFROM hospitality_technology.payments p1\nJOIN hospi...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_i...
[ { "role": "user", "content": "Show the customer_id and pairs of payment_ids for any customers who have overlapping payment periods." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.payment_id AS payment1_id,\n p2.payment_id AS payment2_id\nFROM insurance.premium_pay...
You are an expert in writing database language. You can write a corresponding 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 customers who have both a canceled policy and an active policy. Show customer_id, canceled_policy_id, and active_policy_id." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.policy_id AS canceled_policy_id,\n p2.policy_id AS 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.locations ( location_id.text, name.text, type.text, address_line1.tex...
[ { "role": "user", "content": "List pairs of distinct locations in the same city that share the same location type. Show both location IDs, names, city, and the shared type." }, { "role": "assistant", "content": "SELECT L1.location_id AS location1_id, L1.name AS location1_name, L2.location_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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_nam...
[ { "role": "user", "content": "How many drivers and passengers have email addresses ending with 'company.com'? Return the count for each group." }, { "role": "assistant", "content": "SELECT 'drivers' AS role, COUNT(*) AS count\nFROM transportation.drivers\nWHERE email LIKE '%@company.com'\nUNION ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, ...
[ { "role": "user", "content": "Can you provide the total number of fuel refueling events and the sum of total_cost at each fueling location, including the location name and city?" }, { "role": "assistant", "content": "SELECT l.location_id, l.name, l.city, COUNT(fl.fuel_log_id) AS num_refuels, SUM...
You are an expert in writing database language. You can write a corresponding 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": "Find all pairs of drivers who share the same status. Include both driver_ids, full names, and the shared status." }, { "role": "assistant", "content": "SELECT d1.driver_id AS driver1_id, d1.first_name || ' ' || d1.last_name AS driver1_name, d2.driver_id AS driver2_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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_nam...
[ { "role": "user", "content": "I need a report showing the count of drivers per status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS driver_count\nFROM transportation.drivers\nGROUP BY status;" }, { "role": "user", "content": "Actually, only include statuses that ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_nam...
[ { "role": "user", "content": "For each fueling event, show the fuel_log_id, vehicle_id, the full name of the assigned driver for the trip during that fueling event, and the log_timestamp." }, { "role": "assistant", "content": "SELECT fl.fuel_log_id, fl.vehicle_id, d.first_name || ' ' || d.last_n...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, ...
[ { "role": "user", "content": "Show me all vehicles that had maintenance in the past month, including their make, model, maintenance service_date, and depot name." }, { "role": "assistant", "content": "SELECT v.vehicle_id,\n v.make,\n v.model,\n m.service_date,\n l.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 transportation.routes ( route_id.text, route_number.text, description.text, origin_l...
[ { "role": "user", "content": "List all trips with their ID, vehicle ID, and driver ID." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id FROM transportation.trips;" }, { "role": "user", "content": "Can you also include the scheduled departure and actual arr...
You are an expert in writing database language. You can write a corresponding 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": "Get the total fuel cost per route, showing route_number and the sum of total_cost for all fuel logs associated with trips on that route." }, { "role": "assistant", "content": "SELECT r.route_number,\n SUM(fl.total_cost) AS total_fuel_cost\nFROM transportation....
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name te...
[ { "role": "user", "content": "Find pairs of drivers where the first driver was hired after the second driver, but the first driver's license expires before the second driver's. Show driver IDs, hire dates, and license expiry dates for both drivers in each pair." }, { "role": "assistant", "conten...