conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Show me all guests from California who are loyalty members, along with their email and phone number, ordered by last name." }, { "role": "assistant", "content": "SELECT first_name, last_name, email, phone_number FROM hospitality_technology.guests WHERE state_provinc...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil...
[ { "role": "user", "content": "Find all primary insurance plans that became effective in the last 30 days, showing the patient IDs, policy numbers, and subscriber names, ordered by effective date." }, { "role": "assistant", "content": "SELECT patient_id, policy_number, subscriber_name, effective_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p...
[ { "role": "user", "content": "Show me the total payment amount processed by each staff member for EUR payments, including their staff_id_processed and the count of successful transactions." }, { "role": "assistant", "content": "SELECT staff_id_processed, SUM(amount) AS total_amount_eur, COUNT(*)...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu...
[ { "role": "user", "content": "Show me all cases with a status of 'Pending', displaying their case name and court jurisdiction." }, { "role": "assistant", "content": "SELECT case_name, court_jurisdiction FROM legal_services.cases WHERE status = 'Pending';" }, { "role": "user", "conten...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t...
[ { "role": "user", "content": "List the name, city, state, and country for all locations with a latitude greater than 40 and a longitude less than -70." }, { "role": "assistant", "content": "SELECT name, city, state_province, country FROM transportation.locations WHERE latitude > 40 AND longitude...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro...
[ { "role": "user", "content": "For each narrative and chain, what is the total amount and USD value of tokens bought by users (type=1)?" }, { "role": "assistant", "content": "SELECT narrative, chain, SUM(token_amount) AS total_bought_amount, SUM(usd_value) AS total_bought_usd_value\nFROM smart_mo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character...
[ { "role": "user", "content": "Provide a breakdown of the total number of conversations, showing how many are group chats and how many are not. Also, show the count of conversations that have a recorded last message time." }, { "role": "assistant", "content": "SELECT COUNT(*) AS total_conversatio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR...
[ { "role": "user", "content": "Which medications have 'tablet' in their description? Show their medication name and manufacturer." }, { "role": "assistant", "content": "SELECT medication_name, manufacturer FROM healthcare.medications WHERE description ILIKE '%tablet%';" }, { "role": "user...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "Show me the average number of current players for each server region." }, { "role": "assistant", "content": "SELECT region, AVG(current_players) AS average_players FROM gaming_technology.servers GROUP BY region;" }, { "role": "user", "content": "Now, onl...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id uuid PRIMARY KEY, game_id uuid, server_name text, region text, ip_address text, p...
[ { "role": "user", "content": "List each Avalanche token tick with its creator from token_info and the total transfer volume over the past 7 days." }, { "role": "assistant", "content": "SELECT ta.tick,\n ti.creator,\n SUM(ta.amt) AS total_volume\nFROM token_activities_avalanche ta\nJO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text ) CREATE TABLE n...
[ { "role": "user", "content": "List all servers hosting games that use the 'Unity' engine, including each server's name, region, and the game's release_date." }, { "role": "assistant", "content": "SELECT s.server_name, s.region, g.release_date\nFROM gaming_technology.servers s\nJOIN gaming_techno...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game ti...
[ { "role": "user", "content": "Show me all available spa services (category = 'Wellness') with their names and prices, ordered by price in descending order." }, { "role": "assistant", "content": "SELECT service_name, price FROM hospitality_technology.services WHERE category = 'Wellness' AND is_av...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ...
[ { "role": "user", "content": "What is the total USD value held by all centralized exchanges (CEX) for the token with the symbol 'BTC'?" }, { "role": "assistant", "content": "SELECT SUM(usd_value) AS total_btc_cex_value FROM cex_token_balance WHERE token_symbol = 'BTC';" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Show me document_id, application_id, and verification_status for all documents submitted by citizen 'cit123'." }, { "role": "assistant", "content": "SELECT document_id,\n application_id,\n verification_status\nFROM documents\nWHERE citizen_id = 'cit123';...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "For all bookings, can you provide the booking ID, the passenger ID, and the make and model of the vehicle used for the associated trip?" }, { "role": "assistant", "content": "SELECT b.booking_id, b.passenger_id, v.make, v.model\nFROM transportation.bookings b\nJOIN ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text...
[ { "role": "user", "content": "List the application reference numbers, the corresponding message subjects, and the sent dates for notifications related to each application." }, { "role": "assistant", "content": "SELECT a.reference_number, n.message_subject, n.sent_at\nFROM government_services.app...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, statu...
[ { "role": "user", "content": "List the number of employees hired in each department per year." }, { "role": "assistant", "content": "SELECT\n department,\n EXTRACT(YEAR FROM hire_date) AS hire_year,\n COUNT(employee_id) AS employee_count\nFROM financial_services.employees\nWHERE\n hire_date ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "For each user, show their username, email, and the number of posts they've created that contain at least one hashtag. Only include users who have created such posts." }, { "role": "assistant", "content": "SELECT u.username, u.email, COUNT(DISTINCT p.post_id) AS post...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Find tokens with positive ROI and a positive net flow from smart money addresses. For these tokens, show their symbol, chain, ROI, net flow, and the total USD value from buy transactions." }, { "role": "assistant", "content": "SELECT T1.token_symbol, T1.chain, T1.ro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,...
[ { "role": "user", "content": "For each route, display its route_number, origin city, destination city, and the total number of completed trips." }, { "role": "assistant", "content": "SELECT r.route_number, o.city AS origin_city, d.city AS destination_city, COUNT(t.trip_id) AS completed_trips FRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, -- unique identifier for the route route_numb...
[ { "role": "user", "content": "For every manufacturer, show the total number of medications they produce, and the number of those that have an NDC code starting with '5'." }, { "role": "assistant", "content": "SELECT manufacturer, COUNT(*) AS total_medications, COUNT(CASE WHEN ndc_code LIKE '5%' ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, -- unique identifier for the medication type...
[ { "role": "user", "content": "I want to find all pairs of wallets that belong to the same user." }, { "role": "assistant", "content": "SELECT w1.wallet_id AS wallet1, w2.wallet_id AS wallet2, w1.user_id\nFROM blockchain.wallets w1\nJOIN blockchain.wallets w2\n ON w1.user_id = w2.user_id\n AND ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address_id chara...
[ { "role": "user", "content": "Get the earliest and latest unread notification for each recipient, including notification_ids, types, and timestamps." }, { "role": "assistant", "content": "WITH earliest AS (\n SELECT recipient_user_id, MIN(created_at) AS earliest_time\n FROM social_media.notifi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.notifications ( notification_id character varying(64) NOT NULL, recipient_user_id character varying(64) NO...
[ { "role": "user", "content": "Show all token transfers including the token symbol and the address of the contract that created each token. List the transfer id, token id, value, transaction id, the contract address, and the token symbol." }, { "role": "assistant", "content": "SELECT tt.transfer_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character...
[ { "role": "user", "content": "For each group chat, retrieve the conversation_id, group_name, and the timestamp of the latest like on any comment." }, { "role": "assistant", "content": "SELECT c.conversation_id,\n c.group_name,\n MAX(l.created_at) AS latest_comment_like\nFROM social_m...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp ) CREATE TABLE soc...
[ { "role": "user", "content": "Can you list the number of items for each rarity in the system?" }, { "role": "assistant", "content": "SELECT rarity, COUNT(*) AS item_count\nFROM gaming_technology.in_game_items\nGROUP BY rarity;" }, { "role": "user", "content": "Please only show rariti...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.in_game_items ( item_id uuid PRIMARY KEY, game_id uuid, item_name text, item_type text, description t...
[ { "role": "user", "content": "List all staff members who were hired in the last year, including their position and hire date." }, { "role": "assistant", "content": "SELECT staff_id, first_name, last_name, position, hire_date FROM hospitality_technology.staff WHERE hire_date >= CURRENT_DATE - INT...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, -- unique identifier for the staff member ...
[ { "role": "user", "content": "Show all currently available rooms along with their room numbers and the number of times each room has been reserved." }, { "role": "assistant", "content": "SELECT rm.room_id, rm.room_number, COUNT(r.reservation_id) AS reservation_count\nFROM hospitality_technology....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room...
[ { "role": "user", "content": "Count the number of registered citizens by gender." }, { "role": "assistant", "content": "SELECT\n gender,\n COUNT(*) AS citizen_count\nFROM government_services.citizens\nGROUP BY gender;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Show me all reviews with ratings of 5 stars, including the guest name, property ID, and review date, ordered by review date from newest to oldest." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, r.property_id, rv.review_date FROM hospitality...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ...
[ { "role": "user", "content": "Which insurance products have 'comprehensive' in their coverage details? Show the product_id and product_name." }, { "role": "assistant", "content": "SELECT product_id, product_name FROM insurance.insurance_products WHERE coverage_details ILIKE '%comprehensive%';" ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, bas...
[ { "role": "user", "content": "For all maintenance records, can you show the vehicle's make, model, the odometer reading, and the mechanic's name?" }, { "role": "assistant", "content": "SELECT v.make, v.model, m.odometer_reading, m.mechanic_name FROM transportation.maintenance_logs m JOIN transpo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "List usernames and updated_at timestamps for users updated after June 1, 2024." }, { "role": "assistant", "content": "SELECT username, updated_at FROM social_media.users WHERE updated_at > '2024-06-01';" }, { "role": "user", "content": "Actually, only in...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "Find all beneficiaries added in the last 7 days, include beneficiary_id, policy_id, and percentage_share, sorted by percentage_share descending." }, { "role": "assistant", "content": "SELECT beneficiary_id, policy_id, percentage_share\nFROM insurance.policy_benefici...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "For each player, show the timestamp of their first achievement unlock. Include player_id and the timestamp." }, { "role": "assistant", "content": "SELECT player_id, MIN(unlocked_at) as first_unlock_at FROM gaming_technology.player_achievements GROUP BY player_id ORD...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N...
[ { "role": "user", "content": "List all drivers whose contact number is missing." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name FROM transportation.drivers WHERE contact_number IS NULL OR contact_number = '';" }, { "role": "user", "content": "Also inclu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "List all passengers who have booked a trip to a city named 'Chicago'. Show their first name, last name, email, and the booking ID." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, p.email, b.booking_id\nFROM transportation.bookings b\nJOIN tr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id character varying(64) NOT NULL, -- unique identifier for the location n...
[ { "role": "user", "content": "Find receiver addresses that have received transactions from more than 5 distinct sender addresses. Show the receiver address and the count of distinct senders." }, { "role": "assistant", "content": "SELECT receiver_address, COUNT(DISTINCT sender_address) FROM block...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction ...
[ { "role": "user", "content": "How many prescriptions have been issued per patient?" }, { "role": "assistant", "content": "SELECT patient_id, COUNT(*) AS prescription_count\nFROM healthcare.prescriptions\nGROUP BY patient_id;" }, { "role": "user", "content": "Only show patients who ha...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id text, record_id text, patient_id text, doctor_id text, medication_id text, d...
[ { "role": "user", "content": "For each KYC-approved user, list their wallet address and the date it was created." }, { "role": "assistant", "content": "SELECT w.address, w.created_at\nFROM trading_platform.wallets w\nJOIN trading_platform.kyc_audit k ON w.user_id = k.user_id\nWHERE k.status = 'a...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "Find employees who work in the same department as their manager. Display the employee's full name, the manager's full name, and the department they share." }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.last_name AS employee_full_name, m.first...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.employees ( employee_id character varying(64) NOT NULL, -- unique identifier for the government...
[ { "role": "user", "content": "Find all nodes that were last seen in the last 7 days and have a port number between 8000 and 9000." }, { "role": "assistant", "content": "SELECT node_id, ip_address, port, last_seen FROM blockchain.nodes WHERE last_seen >= NOW() - INTERVAL '7 days' AND port BETWEEN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta...
[ { "role": "user", "content": "Which users have posted content in the same location (latitude and longitude) on the same day? Show their usernames, post_ids, and the posting date." }, { "role": "assistant", "content": "SELECT u1.username AS username1, u2.username AS username2, p1.post_id AS post_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "For each project that held fundraising rounds in 2022, calculate the total investment_value and average valuation, then list the project_name, total_investment, average_valuation, and the token's symbol and current price. Match projects to tokens by case-insensitive equality of...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "List all insurance products that have 'auto' in their product type and are currently active, showing their product name and base premium." }, { "role": "assistant", "content": "SELECT product_name, base_premium FROM insurance.insurance_products WHERE product_type LI...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "Show me all terminated staff members along with their termination dates and the names of their managers, ordered by termination date." }, { "role": "assistant", "content": "SELECT s.staff_id, s.first_name, s.last_name, s.termination_date, m.first_name AS manager_fir...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, -- unique identifier for the staff member ...
[ { "role": "user", "content": "For each game_id, calculate the average points of achievements that have been unlocked at least once." }, { "role": "assistant", "content": "SELECT a.game_id, AVG(a.points) AS average_unlocked_points FROM gaming_technology.achievements a JOIN gaming_technology.playe...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points....
[ { "role": "user", "content": "List all trips that were completed and experienced a significant delay in actual arrival compared to the scheduled arrival (more than 45 minutes)." }, { "role": "assistant", "content": "SELECT\n trip_id,\n vehicle_id,\n driver_id,\n scheduled_arrival,\n actual_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance ...
[ { "role": "user", "content": "How many users are registered in the system?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM blockchain.users;" }, { "role": "user", "content": "List the user ID and email for users whose email contains the string 'support'." }, { "ro...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.users ( user_id.text, username.text, email.text, password_hash.text )
[ { "role": "user", "content": "List all medical records created by doctor 'doc001' for patient 'pat456', displaying the record ID and record date." }, { "role": "assistant", "content": "SELECT record_id, record_date\nFROM healthcare.medical_records\nWHERE doctor_id = 'doc001' AND patient_id = 'pa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "List the first name, last name, and specialization of all lawyers who have uploaded at least one document." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.specialization FROM legal_services.lawyers AS T1 JOIN legal_services.documents AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "List all plan names and their contact numbers for plans of type 'HMO' offered by 'Sunrise Insurance'." }, { "role": "assistant", "content": "SELECT plan_name, contact_phone FROM healthcare.insurance_plans WHERE plan_type = 'HMO' AND insurance_provider = 'Sunrise Ins...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_provider text, plan_type text, contact...
[ { "role": "user", "content": "What is the total investment_value per fundraising round for the year 2023? Order by total investment descending." }, { "role": "assistant", "content": "SELECT\n substr(investment_date,1,7) AS month,\n rounds_name,\n SUM(investment_value) AS total_investment\nFRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "List all claims, showing the claim ID, incident date, and the associated policy number." }, { "role": "assistant", "content": "SELECT T1.claim_id, T1.incident_date, T2.policy_number FROM insurance.claims AS T1 JOIN insurance.policies AS T2 ON T1.policy_id = T2.polic...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Show me pairs of a block and its previous block where the previous block's difficulty was greater than 100000. Include details for both blocks." }, { "role": "assistant", "content": "SELECT t1.block_id AS current_block_id, t2.block_id AS previous_block_id, t1.timest...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta...
[ { "role": "user", "content": "List all document IDs, file names, and uploaded timestamps for documents that were uploaded on a weekend." }, { "role": "assistant", "content": "SELECT document_id, file_name, uploaded_at FROM insurance.claim_documents WHERE EXTRACT(DOW FROM uploaded_at) IN (0, 6);"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ...
[ { "role": "user", "content": "Count how many appointments have been canceled at each location. Return the location and cancelled_count." }, { "role": "assistant", "content": "SELECT location, COUNT(*) AS cancelled_count\nFROM legal_services.appointments\nWHERE status = 'Canceled'\nGROUP BY locat...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Find pairs of notifications for the same citizen where one was sent via 'Email' and another via 'SMS'. Display citizen_id, email_notification_id, sms_notification_id, email_sent_at, and sms_sent_at." }, { "role": "assistant", "content": "SELECT e.citizen_id,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m...
[ { "role": "user", "content": "List each child agency ID and name along with its parent agency ID and name." }, { "role": "assistant", "content": "SELECT c.agency_id AS child_id,\n c.agency_name AS child_name,\n p.agency_id AS parent_id,\n p.agency_name AS parent_name\nFROM gove...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "role": "user", "content": "List each scheduled appointment along with its client_id and the number of other appointments that overlap with it. Include appointment_id, client_id, and overlap_count." }, { "role": "assistant", "content": "SELECT a1.appointment_id,\n a1.client_id,\n C...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "For each token transfer, show the transfer id, token symbol, and the username of the user who owns the sender address. Please order the result by transfer id." }, { "role": "assistant", "content": "SELECT tt.transfer_id, tk.token_symbol, u.username\nFROM web3.token_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_a...
[ { "role": "user", "content": "Get the property name, room type name, base rate, and star rating for all room types with a base_rate above 200 in properties located in the USA, sorted by base_rate in descending order." }, { "role": "assistant", "content": "SELECT p.property_name, rt.type_name, rt...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me the top 3 narratives by trend rank, along with their 7-day price change percentage and total volume." }, { "role": "assistant", "content": "SELECT narrative, price_change_percentage_7d, volume_24h FROM narrative_info ORDER BY trend_rank ASC LIMIT 3;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri...
[ { "role": "user", "content": "Show all transactions where the recipient address matches a wallet address, listing the transaction ID, the recipient address, the user ID who owns the wallet, and the value of the transaction." }, { "role": "assistant", "content": "SELECT tx.transaction_id, tx.to_a...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the contract address cha...
[ { "role": "user", "content": "List all patients who have active primary insurance plans with expiration dates within the next 60 days, including their policy numbers and subscriber names." }, { "role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.subscriber_name FROM healt...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ...
[ { "role": "user", "content": "List all narratives with a negative 1-hour price change percentage and a trend rank below 50." }, { "role": "assistant", "content": "SELECT narrative, price_change_percentage_1h, trend_rank FROM narrative_info WHERE price_change_percentage_1h < 0 AND trend_rank < 50...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative character varying(512) NOT NULL, -- the id of narrative top_3_coins text, -- the top 3 token...
[ { "role": "user", "content": "What is the average daily trading volume for each security_id in the market_data table from the last 30 days, considering only data points where the close_price was higher than the open_price?" }, { "role": "assistant", "content": "SELECT security_id, AVG(volume) AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Find all users who have wallets but have never logged any actions, along with their wallet creation date." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, w.created_at AS wallet_created_at FROM trading_platform.users u JOIN trading_platform.wallets ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "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 SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me all invoices, displaying their invoice number and the payment date, for invoices that have been fully paid." }, { "role": "assistant", "content": "SELECT invoice_number, payment_date FROM legal_services.invoices WHERE status = 'Paid';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice invo...
[ { "role": "user", "content": "Show me all contract addresses deployed by the address '0xabc...def'." }, { "role": "assistant", "content": "SELECT address FROM web3.contracts WHERE deployer_address = '0xabc...def';" }, { "role": "user", "content": "Can you refine that list to only inc...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text...
[ { "role": "user", "content": "Find all services that cost exactly 25, showing their name, department, and property_id." }, { "role": "assistant", "content": "SELECT service_name, department, property_id\nFROM hospitality_technology.services\nWHERE price = 25;" }, { "role": "user", "c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me all premium payments made by customer with ID 'CUST789'." }, { "role": "assistant", "content": "SELECT * FROM insurance.premium_payments WHERE customer_id = 'CUST789';" }, { "role": "user", "content": "From those payments, only include the ones w...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo...
[ { "role": "user", "content": "How many group chats have been created since January 1, 2024?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS group_chat_count\nFROM social_media.conversations\nWHERE is_group_chat = TRUE\n AND created_at >= '2024-01-01';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u...
[ { "role": "user", "content": "List the names and cities of all locations that have at least one fuel log entry recorded." }, { "role": "assistant", "content": "SELECT DISTINCT l.name, l.city\nFROM transportation.locations l\nJOIN transportation.fuel_logs f ON l.location_id = f.location_id;" },...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "List each user ID along with the total count of log entries and the total count of notifications associated with them." }, { "role": "assistant", "content": "SELECT COALESCE(T1.user_id, T2.user_id) AS user_id, COUNT(DISTINCT T1.log_id) AS log_count, COUNT(DISTINCT T...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "Show me the name and type for all the locations." }, { "role": "assistant", "content": "SELECT name, type FROM transportation.locations" }, { "role": "user", "content": "Now, filter this list to only include locations whose type is either 'Distribution C...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ...
[ { "role": "user", "content": "List the citizen IDs for individuals who have both uploaded documents and made payments." }, { "role": "assistant", "content": "SELECT DISTINCT T1.citizen_id FROM documents AS T1 JOIN payments AS T2 ON T1.citizen_id = T2.citizen_id" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "role": "user", "content": "Which projects raised funds in January 2022?" }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, investment_date FROM project_fundraising_record WHERE investment_date >= '2022-01-01' AND investment_date < '2022-02-01';" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "How many passenger records were created in the year 2023?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM transportation.passengers WHERE EXTRACT(YEAR FROM created_at) = 2023;" }, { "role": "user", "content": "What about the number of passeng...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.passengers ( passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger ...
[ { "role": "user", "content": "List the product ID and product name of all insurance products created in 2024." }, { "role": "assistant", "content": "SELECT product_id, product_name\nFROM insurance.insurance_products\nWHERE created_at >= '2024-01-01' AND created_at < '2025-01-01';" }, { "...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, bas...
[ { "role": "user", "content": "What is the average ROI and average realized_ratio for each chain?" }, { "role": "assistant", "content": "SELECT chain,\n AVG(roi) AS avg_roi,\n AVG(realized_ratio) AS avg_realized_ratio\nFROM smart_money_token_performance\nGROUP BY chain;" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,...
[ { "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 SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique identifier for the client first_n...
[ { "role": "user", "content": "Show me all claim documents that are PDFs, along with their claim IDs and file sizes." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_size_bytes FROM insurance.claim_documents WHERE mime_type = 'application/pdf';" }, { "role": "user...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "Who are the top 3 agents with the highest commission rate? Show their full names and commission rates." }, { "role": "assistant", "content": "SELECT first_name, last_name, commission_rate\nFROM insurance.agents\nORDER BY commission_rate DESC\nLIMIT 3;" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name chara...
[ { "role": "user", "content": "List patients who have appointments scheduled, their appointment time, the name of their primary insurance plan, and the provider name." }, { "role": "assistant", "content": "SELECT p.first_name AS patient_first_name, p.last_name AS patient_last_name, a.appointment_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "List all primary insurance policies that will expire within the next 30 days. Return patient_insurance_id, patient_id, policy_number, and expiration_date." }, { "role": "assistant", "content": "SELECT patient_insurance_id,\n patient_id,\n policy_number,\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam...
[ { "role": "user", "content": "List all transaction IDs, sender addresses, and amounts for transactions received by '0xFEDCBA9876543210FEDCBA9876543210FEDCBA98' between '2023-01-01' and '2023-03-31'." }, { "role": "assistant", "content": "SELECT transaction_id, sender_address, amount FROM blockch...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id character varying(64) NOT NULL, -- uni...
[ { "role": "user", "content": "List all active policies for 'home' insurance products, including policy number, product name, and the first and last name of the agent who sold it." }, { "role": "assistant", "content": "SELECT T1.policy_number, T2.product_name, T3.first_name, T3.last_name FROM pol...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "For each booking, list the booking_id, trip_id, origin city, destination city, and fare." }, { "role": "assistant", "content": "SELECT b.booking_id, b.trip_id, lo.city AS origin_city, ld.city AS destination_city, b.fare\nFROM transportation.bookings b\nJOIN transpor...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Show me all notifications that are related to posts created by users who have a verified profile. Include the notification type, the recipient username, and the post ID." }, { "role": "assistant", "content": "SELECT\n n.notification_type,\n u_recipient.username AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "List all beneficiaries added in the last 6 months with a percentage share greater than 25%. Include their beneficiary ID, policy ID, customer ID, first name, last name, relationship, and percentage share. Order the results by the date they were added, oldest first." }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, la...
[ { "role": "user", "content": "Identify all instances where a vehicle's odometer_reading decreased compared to its previous fuel log entry." }, { "role": "assistant", "content": "SELECT curr.vehicle_id,\n prev.fuel_log_id AS previous_log_id,\n prev.odometer_reading AS previous_readi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu...
[ { "role": "user", "content": "Show the prescription ID, medication name, and patient full name for all prescriptions issued in the last 30 days." }, { "role": "assistant", "content": "SELECT pr.prescription_id, m.medication_name, CONCAT(p.first_name, ' ', p.last_name) AS patient_name\nFROM healt...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List the patient ID and subscriber name for all patients who have both at least one diagnosis recorded and at least one primary insurance policy." }, { "role": "assistant", "content": "SELECT DISTINCT pi.patient_id, pi.subscriber_name FROM healthcare.patient_insuran...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry ...
[ { "role": "user", "content": "List the conversation IDs and user IDs for participants who have email notifications enabled." }, { "role": "assistant", "content": "SELECT cp.conversation_id, cp.user_id FROM social_media.conversation_participants AS cp JOIN social_media.user_settings AS us ON cp.u...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "Show me the number of direct replies each top-level comment has on post 'P200'." }, { "role": "assistant", "content": "SELECT c.comment_id, COUNT(r.comment_id) AS reply_count FROM comments AS c LEFT JOIN comments AS r ON r.parent_comment_id = c.comment_id WHERE c.po...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "Show me all securities (security_id, ticker_symbol, security_name, currency) that are denominated in EUR or GBP, along with the employees (employee_id, email) who last updated them (assuming last_updated corresponds to employee actions)." }, { "role": "assistant", "...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.securities ( security_id character varying(64) NOT NULL, -- unique identifier for the security ...
[ { "role": "user", "content": "Show me the usernames and full names of all users who have updated their profile after April 1, 2024, and have specified a location." }, { "role": "assistant", "content": "SELECT username, full_name FROM social_media.users WHERE updated_at > '2024-04-01' AND locatio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "Please provide each follow relationship, including the follower's username, the followed user's username, and the follow creation timestamp." }, { "role": "assistant", "content": "SELECT\n u1.username AS follower_username,\n u2.username AS following_username,\n f...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...