conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "How many agents were hired in the year 2023?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS agents_hired_2023 FROM insurance.agents WHERE hire_date BETWEEN '2023-01-01' AND '2023-12-31';" } ]
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 text, first_name text, last_name text, agency_name text, license_number text, license_state...
[ { "role": "user", "content": "List each property with the total number of active staff members and the average base rate of its room types." }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, COUNT(s.staff_id) AS active_staff_count, ROUND(AVG(rt.base_rate), 2) AS avg_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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "For each game, I need a breakdown of how many sessions each server has hosted and what percentage of that game's total sessions each server represents. Display game_id, server_id, server_name, session_count, and session_percentage." }, { "role": "assistant", "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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Find all medications whose generic_name matches the medication_name of another entry, displaying the brand medication_id, brand medication_name, generic medication_id, and generic medication_name." }, { "role": "assistant", "content": "SELECT b.medication_id AS bran...
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.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,...
[ { "role": "user", "content": "List all maintenance services performed on vehicle 'VHCL789', showing the service date and type." }, { "role": "assistant", "content": "SELECT service_date, service_type FROM transportation.maintenance_logs WHERE vehicle_id = 'VHCL789';" }, { "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 transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_ty...
[ { "role": "user", "content": "Summarize the total principal amount for loans, grouped by customer and their account type. Include the customer's full name." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.account_type, SUM(T3.principal_amount) FROM financial_services...
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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ...
[ { "role": "user", "content": "Retrieve all pairs of nodes where one node was last seen before '2023-06-01' and the other after '2023-06-01', and they share the same IP address." }, { "role": "assistant", "content": "SELECT a.node_id AS node_before,\n b.node_id AS node_after,\n a.ip_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 blockchain.nodes ( node_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port integer NOT ...
[ { "role": "user", "content": "List the full names of citizens who have submitted applications for services provided by agencies at the 'Federal' jurisdiction level." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name FROM government_services.citizens AS T1 INNER JOIN govern...
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 each patient, show their full name and the count of insurance plans they are enrolled in, as well as their earliest policy effective date." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, COUNT(pi.plan_id) AS plan_count, MIN(pi.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.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List all securities that have had at least one market data entry where the closing price was higher than the opening price, including their security name and ticker symbol." }, { "role": "assistant", "content": "SELECT DISTINCT T1.security_name, T1.ticker_symbol 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 financial_services.transactions ( transaction_id text, account_id text, related_account_id text, transaction_type text,...
[ { "role": "user", "content": "Retrieve a list of all patient insurance policies, showing the subscriber name and the name of the insurance provider for the plan." }, { "role": "assistant", "content": "SELECT T1.subscriber_name, T2.insurance_provider FROM healthcare.patient_insurance AS T1 JOIN h...
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 a list of all customers from California along with their full names and phone numbers." }, { "role": "assistant", "content": "SELECT customer_id, first_name || ' ' || last_name AS full_name, phone_number FROM insurance.customers WHERE state = 'CA';" }, {...
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, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "For each citizen who has at least one document pending verification and at least one appointment not completed, display the citizen's full name, the document type, the document's upload timestamp, the appointment ID, and the appointment status." }, { "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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "List each lawyer's full name with the full name of the partner at the same firm." }, { "role": "assistant", "content": "SELECT l.lawyer_id,\n CONCAT(l.first_name, ' ', l.last_name) AS lawyer_name,\n CONCAT(p.first_name, ' ', p.last_name) AS partner_name\...
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 character varying(64) NOT NULL, -- unique identifier for the lawyer first_n...
[ { "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 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, employee_id text, first_name text, last_name text, license_number text, licens...
[ { "role": "user", "content": "What is the average commission for trades executed on the 'NYSE' venue?" }, { "role": "assistant", "content": "SELECT AVG(commission) FROM financial_services.trades WHERE execution_venue = 'NYSE';" } ]
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.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity....
[ { "role": "user", "content": "For each passenger, compute the count of bookings and average fare for bookings made in February 2024." }, { "role": "assistant", "content": "SELECT p.passenger_id, COUNT(b.booking_id) AS booking_count, AVG(b.fare) AS avg_fare\nFROM transportation.passengers p\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 character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "Show the top 10 most expensive fuel log entries including fuel_log_id, vehicle make and model, location name and city, and total_cost." }, { "role": "assistant", "content": "SELECT f.fuel_log_id,\n v.make,\n v.model,\n loc.name AS location_name,\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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Get me each user's latest KYC review status along with the number of orders they have placed." }, { "role": "assistant", "content": "WITH latest AS (\n SELECT user_id, status\n FROM trading_platform.kyc_audit\n WHERE (user_id, reviewed_at) IN (\n SELECT user_i...
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.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "List the first name, last name, and hire date for all lawyers who were hired after the year 2020." }, { "role": "assistant", "content": "SELECT first_name, last_name, hire_date FROM legal_services.lawyers WHERE hire_date > '2020-12-31'" } ]
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": "Show me all wallets holding SUI coins with a balance greater than 2,000,000. Include the coin_type, balance, and owner address." }, { "role": "assistant", "content": "SELECT coin_type, balance, owner FROM sui_coins WHERE status = 'exists' AND CAST(balance AS bigint)...
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_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "For every game, can you provide the count of unique item types and the average item cost?" }, { "role": "assistant", "content": "SELECT game_id, COUNT(DISTINCT item_type) AS num_unique_types, AVG(cost_amount) AS avg_item_cost FROM gaming_technology.in_game_items GRO...
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 NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the ite...
[ { "role": "user", "content": "List each public post's ID and the count of notifications it has received. Only consider notifications where target_entity_type is 'post'." }, { "role": "assistant", "content": "SELECT p.post_id, COUNT(n.notification_id) AS notification_count\nFROM social_media.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.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi...
[ { "role": "user", "content": "Which users have participated in conversations that are not group chats? Please show their usernames and the conversation IDs." }, { "role": "assistant", "content": "SELECT u.username, cp.conversation_id\nFROM social_media.conversation_participants cp\nJOIN 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.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "For each service category, find the total number of notifications sent related to applications of services in that category." }, { "role": "assistant", "content": "SELECT s.category, COUNT(n.notification_id) AS notification_count\nFROM government_services.notificati...
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": "Which SUI coins have a supply greater than 10,000 and include their symbol and name?" }, { "role": "assistant", "content": "SELECT scm.symbol, scm.name, sc.coin_type, SUM(CAST(sc.balance AS DECIMAL)) AS total_supply FROM sui_coins sc JOIN sui_coins_metadata scm ON s...
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_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Find all top-level agencies that do not have a parent agency. Display their agency_id and agency_name." }, { "role": "assistant", "content": "SELECT agency_id, agency_name\nFROM government_services.agencies\nWHERE parent_agency_id IS NULL;" } ]
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": "What is the average interest rate for loans of type 'Mortgage'?" }, { "role": "assistant", "content": "SELECT AVG(interest_rate) FROM financial_services.loans WHERE loan_type = 'Mortgage'" }, { "role": "user", "content": "Refine this to only include loan...
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.loans ( loan_id.text, account_id.text, loan_type.text, principal_amount.numeric, current_principal_b...
[ { "role": "user", "content": "Which projects raised more than 10 million in their fundraising rounds, and what are their round names and valuations?" }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, valuation FROM project_fundraising_record WHERE investme...
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": "Show me all active managers along with their property names and the number of staff they supervise." }, { "role": "assistant", "content": "SELECT m.staff_id, CONCAT(m.first_name, ' ', m.last_name) AS manager_name, p.property_name, COUNT(s.staff_id) AS supervised_sta...
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": "What are the fuel consumption rates per hour for the Boeing 747-8 model?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. 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 manufacturing.aircraft_mod...
[ { "role": "user", "content": "Find all clients who share the same address, showing both clients' names, emails, and the common address." }, { "role": "assistant", "content": "SELECT c1.first_name AS first_name1, c1.last_name AS last_name1, c1.email AS email1, c2.first_name AS first_name2, c2.las...
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": "For each group conversation, get the latest message's sender_user_id and sent_at, including conversation_id and group_name." }, { "role": "assistant", "content": "SELECT c.conversation_id, c.group_name, m.sender_user_id, m.sent_at\nFROM social_media.conversations 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 social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "Which fundraising rounds had more than 5 projects participate, and what was the total investment value for each?" }, { "role": "assistant", "content": "SELECT rounds_name, COUNT(DISTINCT project_id) AS project_count, SUM(investment_value) AS total_investment FROM pr...
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 ch...
[ { "role": "user", "content": "What is the latest adjusted_close_price and its timestamp for each security?" }, { "role": "assistant", "content": "SELECT s.security_id, s.security_name, m.adjusted_close_price, m.data_timestamp\nFROM financial_services.market_data m\nJOIN financial_services.securi...
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.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N...
[ { "role": "user", "content": "List the medication_name and manufacturer for all medications where the description is null or an empty string." }, { "role": "assistant", "content": "SELECT medication_name, manufacturer FROM healthcare.medications WHERE description IS NULL OR description = '';" ...
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, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List pairs of distinct routes that originate from the same location but go to different destinations. Show the route ID and route number for both routes and the common origin location ID." }, { "role": "assistant", "content": "SELECT\n r1.route_id AS route1_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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati...
[ { "role": "user", "content": "Show me the total balance for each SUI coin type for coins with status 'exists'. Include the coin type and the sum of balances." }, { "role": "assistant", "content": "SELECT coin_type, SUM(CAST(balance AS DECIMAL)) AS total_balance FROM sui_coins WHERE status = 'exi...
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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "Retrieve all notifications with status 'failed' along with the citizen's full name and contact_phone for those notifications that occurred in the past 30 days." }, { "role": "assistant", "content": "SELECT n.notification_id,\n n.sent_at,\n n.status,\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.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "List all wallet addresses holding NFT contract '0xbbbb...' and token ID '99'." }, { "role": "assistant", "content": "SELECT wallet_address, amount\nFROM nft_holders\nWHERE contract_address = '0xbbbb...'\n AND token_id = '99';" }, { "role": "user", "cont...
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_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "List the first name, last name, and agency name for all agents whose status is 'active'." }, { "role": "assistant", "content": "SELECT first_name, last_name, agency_name FROM insurance.agents WHERE status = 'active';" }, { "role": "user", "content": "Cou...
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.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "Which citizens have submitted applications for services offered by agencies established before 2020? Please show the citizen's first name, last name, and the agency's name." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.agency_name\nFROM ...
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, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Show me all policies where the total percentage share of beneficiaries exceeds 100%, along with the policy IDs and the sum of percentage shares." }, { "role": "assistant", "content": "SELECT policy_id, SUM(percentage_share) AS total_percentage FROM insurance.policy_...
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, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "List all ERC20 tokens with their names and symbols where the price is greater than $100, sorted by price in descending order." }, { "role": "assistant", "content": "SELECT scm.name, scm.symbol, tpl.price FROM sui_coins_metadata scm JOIN token_prices_latest tpl ON sc...
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 nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.t...
[ { "role": "user", "content": "Show me all beneficiaries who were added in the last 3 months, along with their policy IDs and percentage shares, sorted by the highest percentage share first." }, { "role": "assistant", "content": "SELECT beneficiary_id, policy_id, percentage_share FROM insurance.p...
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, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "Show me the latest price and symbol for all tokens listed in the token_prices_latest table." }, { "role": "assistant", "content": "SELECT symbol, price FROM token_prices_latest;" }, { "role": "user", "content": "Filter that to only show tokens on the 'bi...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t...
[ { "role": "user", "content": "Find users who have created wallets on more than one distinct day, listing their user ID and the number of distinct days they created wallets." }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT DATE(created_at)) AS distinct_creation_days FROM web3...
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.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
[ { "role": "user", "content": "Show me the names and providers of all insurance plans, along with their plan type." }, { "role": "assistant", "content": "SELECT plan_name, insurance_provider, plan_type FROM healthcare.insurance_plans;" }, { "role": "user", "content": "Only include tho...
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": "List all rooms with their number, property ID, floor, and status where the room has the feature 'Balcony'." }, { "role": "assistant", "content": "SELECT room_id, room_number, property_id, floor, status FROM hospitality_technology.rooms WHERE features ILIKE '%Balcony...
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": "List all cancelled trips along with their scheduled departure times and vehicle IDs." }, { "role": "assistant", "content": "SELECT trip_id, scheduled_departure, vehicle_id FROM transportation.trips WHERE status = 'Cancelled';" }, { "role": "user", "conte...
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": "Count the number of agents for each license state. Show the license state and the count." }, { "role": "assistant", "content": "SELECT license_state, COUNT(agent_id) FROM insurance.agents GROUP BY license_state;" } ]
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, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d...
[ { "role": "user", "content": "Which players have not logged in in the last 30 days but have unlocked any achievements? Show player_id, username, and total unlocked achievements." }, { "role": "assistant", "content": "SELECT p.player_id, p.username, COUNT(pa.achievement_id) AS total_unlocked\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 gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ...
[ { "role": "user", "content": "Show me all male patients who have an email address but no emergency contact listed, along with their full names and phone numbers." }, { "role": "assistant", "content": "SELECT CONCAT(first_name, ' ', last_name) AS full_name, phone_number FROM healthcare.patients 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List all employees and the department their manager belongs to. Include the employee's full name." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, m.department AS manager_department FROM financial_services.employees AS e LEFT JOIN financial_s...
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 text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "Show me all clients who have appointments with lawyers from law firms located at the same address as their own company. I want to see the client's first and last name, company name, the lawyer's name, the law firm's name, and the shared address." }, { "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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List, for each passenger and trip combination, the total number of bookings and the total fare paid on that trip by each passenger." }, { "role": "assistant", "content": "SELECT passenger_id, trip_id, COUNT(*) AS booking_count, SUM(fare) AS total_fare\nFROM 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.bookings ( booking_id character varying(64) NOT NULL, -- unique identifier for the booking pass...
[ { "role": "user", "content": "List the usernames and emails of all users who registered on '2023-03-15'." }, { "role": "assistant", "content": "SELECT username, email FROM web3.users WHERE DATE(created_at) = '2023-03-15';" }, { "role": "user", "content": "Instead of the list, can you...
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.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
[ { "role": "user", "content": "Show me all properties in California with a star rating above 4.0, along with their room types and base rates." }, { "role": "assistant", "content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p JOIN hosp...
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, property_name character varying(255) NO...
[ { "role": "user", "content": "Show me the average order price and total quantity traded for each asset, but only for completed orders in the last 30 days." }, { "role": "assistant", "content": "SELECT asset_id, AVG(price) AS avg_price, SUM(quantity) AS total_quantity FROM trading_platform.orders...
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.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch...
[ { "role": "user", "content": "Which available services in the 'Wellness' category are offered by each property? Please show property_id, service_name, and price." }, { "role": "assistant", "content": "SELECT property_id, service_name, price FROM hospitality_technology.services WHERE category = '...
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 text PRIMARY KEY, property_id text, service_name text, description text, c...
[ { "role": "user", "content": "For each property, list the names of all available services in the 'Wellness' category. Show property name and service name." }, { "role": "assistant", "content": "SELECT T1.property_name, T2.service_name FROM hospitality_technology.properties AS T1 JOIN 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.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "For each medical record, find the number of diagnoses it has and display record_id, patient_id, and diagnosis_count, but include only records with at least two diagnoses." }, { "role": "assistant", "content": "SELECT m.record_id,\n m.patient_id,\n 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 healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d...
[ { "role": "user", "content": "Show me the post ID, user ID, and creation time for all posts created in April 2024." }, { "role": "assistant", "content": "SELECT post_id, user_id, created_at FROM social_media.posts WHERE created_at >= '2024-04-01' AND created_at < '2024-05-01';" }, { "rol...
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": "Show me wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address, from the nft_holders table." }, { "role": "assistant", "content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE contract...
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_metas ( block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded ...
[ { "role": "user", "content": "Show the total number of policies issued by each agent, along with the sum of premium amounts for those policies." }, { "role": "assistant", "content": "SELECT agent_id, COUNT(*) AS policy_count, SUM(premium_amount) AS total_premium FROM insurance.policies GROUP BY ...
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.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "Show me all game sessions that do not have a score recorded. List the session_id, player_id, game_id, and start_time." }, { "role": "assistant", "content": "SELECT session_id, player_id, game_id, start_time FROM gaming_technology.game_sessions WHERE score IS NULL;" ...
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.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w...
[ { "role": "user", "content": "For each patient, show the total number of diagnoses they have received, along with their patient ID and the ID of their latest diagnosis. Join with the diagnoses table." }, { "role": "assistant", "content": "SELECT patient_id, COUNT(diagnosis_id) AS diagnosis_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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "Which insurance agents have handled claims for policies they personally sold? Show the agent_id, agent's first and last name, the claim_id, and the policy_number." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name, a.last_name, c.claim_id, p.poli...
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": "Show me all appointments scheduled to last exactly 60 minutes." }, { "role": "assistant", "content": "SELECT appointment_id, patient_id, doctor_id, appointment_time, duration_minutes, status\nFROM healthcare.appointments\nWHERE duration_minutes = 60;" } ]
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.appointments ( appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment ...
[ { "role": "user", "content": "List all hashtags created in March 2024 along with their creation timestamps." }, { "role": "assistant", "content": "SELECT hashtag_id, tag_name, created_at\nFROM social_media.hashtags\nWHERE created_at BETWEEN '2024-03-01 00:00:00' AND '2024-03-31 23:59:59';" } ]
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.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre...
[ { "role": "user", "content": "List all transactions that involve token transfers, along with the token names and the contract addresses where these tokens are deployed." }, { "role": "assistant", "content": "SELECT t.transaction_id, t.from_address, t.to_address, tk.token_name, tk.contract_addres...
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, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "What is the average ROI for all smart money addresses on the Binance chain?" }, { "role": "assistant", "content": "SELECT AVG(roi) FROM smart_money_profit WHERE chain = 'Binance';" } ]
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_profit ( address character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres...
[ { "role": "user", "content": "Retrieve all room types with a base_rate above 150 for each property." }, { "role": "assistant", "content": "SELECT property_id, type_name, base_rate\nFROM hospitality_technology.room_types\nWHERE base_rate > 150;" }, { "role": "user", "content": "Also 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 hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, -- unique identifier for the room ...
[ { "role": "user", "content": "Could you show me each employee's full name along with their manager's full name?" }, { "role": "assistant", "content": "SELECT e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n m.employee_id AS manager_id,\n m.first_name || '...
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": "Show the medication name, manufacturer, dosage, and frequency for all prescriptions issued by doctor with ID 'doctor_456'." }, { "role": "assistant", "content": "SELECT m.medication_name, m.manufacturer, p.dosage, p.frequency FROM healthcare.prescriptions p JOIN hea...
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 text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show me each sender_user_id along with the total number of messages they have sent in each conversation." }, { "role": "assistant", "content": "SELECT conversation_id, sender_user_id, COUNT(*) AS message_count FROM social_media.messages GROUP BY conversation_id, sen...
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.messages ( message_id character varying(64) NOT NULL, conversation_id character varying(64) NOT NULL, send...
[ { "role": "user", "content": "Show the average maintenance cost for each service type per vehicle." }, { "role": "assistant", "content": "SELECT vehicle_id,\n service_type,\n AVG(cost) AS avg_cost\nFROM transportation.maintenance_logs\nGROUP BY vehicle_id, service_type;" }, { ...
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 PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Find managers who have at least one agent reporting to them whose status is 'inactive'. List the manager's full name and the full name of the inactive agent." }, { "role": "assistant", "content": "SELECT T2.first_name AS manager_first_name, T2.last_name AS manager_l...
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.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "Show me the top 5 users who have interacted with the most DApps, along with the count of DApps they interacted with." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(DISTINCT d.dapp_id) AS dapp_count FROM trading_platform.users u JOIN tradi...
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": "For each property, show the number of guests who have checked in since the start of this year." }, { "role": "assistant", "content": "SELECT p.property_name, COUNT(DISTINCT res.guest_id) AS guest_count\nFROM hospitality_technology.reservations res\nJOIN 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.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List the number of bookings for each day." }, { "role": "assistant", "content": "SELECT DATE(booking_time) AS booking_date, COUNT(*) AS booking_count\nFROM transportation.bookings\nGROUP BY DATE(booking_time);\n" }, { "role": "user", "content": "Now only...
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.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, s...
[ { "role": "user", "content": "Give me a list of all unpaid invoices along with the first and last names of the clients and the issue date of each invoice." }, { "role": "assistant", "content": "SELECT i.invoice_number, i.issue_date, c.first_name, c.last_name\nFROM legal_services.invoices i\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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List all users who currently have a 'pending' KYC status, showing their user ID and username." }, { "role": "assistant", "content": "SELECT u.user_id, u.username FROM users u JOIN kyc_audit k ON u.user_id = k.user_id WHERE k.status = 'pending';" } ]
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": "List the first and last names, email, and loyalty program ID of all passengers who joined after January 1, 2024." }, { "role": "assistant", "content": "SELECT first_name, last_name, email, loyalty_program_id\nFROM transportation.passengers\nWHERE created_at > '2024-...
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 booking, show the booking_id, passenger's first name and last name, the trip_id, and the route_number associated with the trip." }, { "role": "assistant", "content": "SELECT b.booking_id, p.first_name, p.last_name, b.trip_id, r.route_number\nFROM transporta...
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": "What is the average investment value for projects that completed Series A funding rounds?" }, { "role": "assistant", "content": "SELECT AVG(investment_value) AS average_investment FROM project_fundraising_record WHERE rounds_name = 'Series 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 project_fundraising_record (", "id character varying(32) NOT NULL, -- fundraising record id", "project_id ch...
[ { "role": "user", "content": "Show me a list of comments and the names of hashtags associated with the posts those comments are on." }, { "role": "assistant", "content": "SELECT T1.comment_id, T3.tag_name FROM comments AS T1 JOIN post_hashtags AS T2 ON T1.post_id = T2.post_id JOIN hashtags AS T3...
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": "List tokens with smart money ROI greater than 5 on the Ethereum chain and show their current market cap." }, { "role": "assistant", "content": "SELECT T2.token_symbol, T2.market_cap, T1.roi FROM smart_money_token_performance AS T1 JOIN token_basic_info AS T2 ON T1.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 token_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO...
[ { "role": "user", "content": "List all distinct bed types and their corresponding maximum occupancies for each property." }, { "role": "assistant", "content": "SELECT property_id, bed_type, MAX(max_occupancy) AS max_occupancy FROM hospitality_technology.room_types GROUP BY property_id, bed_type;...
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.text, property_id.text, type_name.text, description.text, base_rate.nu...
[ { "role": "user", "content": "For each service ID, show the average and maximum payment amount for payments made in the last 90 days." }, { "role": "assistant", "content": "SELECT service_id, AVG(amount), MAX(amount) FROM government_services.payments WHERE payment_timestamp >= NOW() - INTERVAL '...
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.payments ( payment_id.text, application_id.text, citizen_id.text, service_id.text, amount.numeric, ...
[ { "role": "user", "content": "Can you list all SUI coins with 'active' status and their owner addresses and balances?" }, { "role": "assistant", "content": "SELECT object_id, coin_type, owner, balance\nFROM sui_coins\nWHERE status = 'active';" }, { "role": "user", "content": "Add the...
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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "Show me prescriptions with a route of 'Intravenous' and a frequency of 'Once Daily'. I need the prescription ID, medication ID, route, and frequency." }, { "role": "assistant", "content": "SELECT prescription_id , medication_id , route , frequency FROM healthcare...
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.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "Show me service orders and any associated review comments for reservation ID 'RES007'. List the order ID, service ID, quantity, total price from the order, and the review comment if available." }, { "role": "assistant", "content": "SELECT so.order_id, so.service_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 hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i...
[ { "role": "user", "content": "I want to retrieve a list of all doctors along with every insurance plan name, showing doctor ID, first and last names, and insurance plan name." }, { "role": "assistant", "content": "SELECT d.doctor_id, d.first_name, d.last_name, p.plan_name\nFROM healthcare.doctor...
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 character varying(64) NOT NULL, -- unique identifier for the doctor first_name ...
[ { "role": "user", "content": "List the claim ID, incident date, and the file name of any associated document for claims reported after '2024-01-01'." }, { "role": "assistant", "content": "SELECT T1.claim_id, T1.incident_date, T2.file_name FROM insurance.claims AS T1 JOIN insurance.claim_document...
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": "Show me each wallet's address and the total number of trades where the wallet's user was the buyer, along with the symbol and name of the asset traded." }, { "role": "assistant", "content": "SELECT w.address, COUNT(t.trade_id) AS buyer_trade_count, o.asset_id\nFROM ...
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": "Get the name of each agency and the count of accessible service locations it operates in. Only include agencies that have more than two accessible locations." }, { "role": "assistant", "content": "SELECT a.agency_name, COUNT(sl.location_id) AS accessible_locations\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.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "Show me all token transfers where the from_address is the same as the to_address, indicating self-transfers, along with the token_id and value." }, { "role": "assistant", "content": "SELECT transfer_id, token_id, from_address, to_address, value, transaction_id FROM ...
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.token_transfers ( transfer_id.text, token_id.text, from_address.text, to_address.text, value.numeric, transaction_...
[ { "role": "user", "content": "List patient_id, full name, policy_number, plan_type, and insurance_provider for all active primary insurance policies." }, { "role": "assistant", "content": "SELECT pi.patient_id,\n p.first_name,\n p.last_name,\n pi.policy_number,\n ip.plan_...
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 text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "For each maintenance log, list the vehicle's license plate, the name of the mechanic, and the service date, ordered by most recent service first." }, { "role": "assistant", "content": "SELECT ml.log_id, v.license_plate, ml.mechanic_name, ml.service_date\nFROM transp...
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 PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...