conversations
listlengths
2
8
system
stringlengths
288
8.03k
[ { "role": "user", "content": "List all clients along with their case_number and case_type for cases that are currently 'Open'." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, c.email, cs.case_number, cs.case_type\nFROM legal_services.clients AS c\nJOIN legal_services.cas...
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, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "List all guests who have made at least one reservation. Show their first and last names and the number of reservations they have made." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, COUNT(r.reservation_id) AS reservation_count\nFROM hospita...
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": "Show the full names and contact emails of all citizens who have applied for services with a standard fee greater than 100." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS full_name, c.contact_email\nFROM government_services.citize...
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 the plan name and insurance provider for all insurance plans along with the total number of unique patients enrolled in each plan." }, { "role": "assistant", "content": "SELECT ip.plan_name, ip.insurance_provider, COUNT(DISTINCT pi.patient_id) AS enrolled_patie...
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": "How many time entries does each client have? Provide the client's first and last name along with the count, sorted by count descending." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(te.entry_id) AS entry_count FROM legal_services.cli...
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, first_name text, last_name text, company_name text, email text, phone text, ad...
[ { "role": "user", "content": "Calculate the average payment amount for all completed payments associated with services categorized as 'Healthcare'." }, { "role": "assistant", "content": "SELECT AVG(T1.amount) FROM government_services.payments AS T1 INNER JOIN government_services.applications 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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "role": "user", "content": "Can you provide the total investment amount and the number of projects for each fundraising round?" }, { "role": "assistant", "content": "SELECT rounds_name, SUM(investment_value) AS total_investment, COUNT(DISTINCT project_name) AS project_count FROM project_fundra...
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 premium payments were made using 'Credit Card' as the payment method?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS credit_card_payments\nFROM insurance.premium_payments\nWHERE payment_method = 'Credit Card';" } ]
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": "List the top 5 Avalanche tokens by total transfer volume in token_activities_avalanche." }, { "role": "assistant", "content": "SELECT tick, SUM(amt) AS total_volume\nFROM token_activities_avalanche\nGROUP BY tick\nORDER BY total_volume DESC\nLIMIT 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Show me the list of hashtags that have been used, along with the time they were first used." }, { "role": "assistant", "content": "SELECT tag_name, created_at \nFROM social_media.hashtags;" } ]
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": "For each Avalanche token tick, calculate the total transfer volume and transaction count over the past 7 days using token_activities_avalanche. Include the token tick, total_volume, and tx_count." }, { "role": "assistant", "content": "SELECT\n tick,\n SUM(amt) 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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Show the guest's full name, reservation ID, check-in date, and status for all reservations made via 'Phone'." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, r.reservation_id, r.check_in_date, r.status FROM hospitality_technology.reservations...
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, first_name character varying(100) NOT NULL, la...
[ { "role": "user", "content": "List all wallet addresses that have unspent UTXOs with amounts greater than 100, along with the total unspent amount for each address." }, { "role": "assistant", "content": "SELECT w.address, SUM(u.amount) AS total_unspent FROM trading_platform.wallets w JOIN tradin...
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": "Provide a summary that shows, for each property, the total number of distinct amenities listed across all its room types." }, { "role": "assistant", "content": "SELECT property_id, COUNT(DISTINCT TRIM(UNNEST(string_to_array(amenities, ',')))) AS total_amenities 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 hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ...
[ { "role": "user", "content": "What is the current market price of a Boeing 737 MAX aircraft?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to the current market price of aircraft models. The data I have is limited to technical specifications and general information ab...
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": "List the content and sent time for messages sent by user 'U101'." }, { "role": "assistant", "content": "SELECT content, sent_at FROM social_media.messages WHERE sender_user_id = 'U101';" }, { "role": "user", "content": "Could you also include the group 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 social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message convers...
[ { "role": "user", "content": "Find pairs of insurance policies where the plan_id is the same, but they belong to different patients. Show the plan_id, and the patient_id and policy_number for both policies in the pair." }, { "role": "assistant", "content": "SELECT T1.plan_id, T1.patient_id AS 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.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb...
[ { "role": "user", "content": "What are the specific tools or equipment used during the maintenance with record_id 'REC456'?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about the specific tools or equipment used during a maintenance record. The data in the ma...
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 train_station_management.m...
[ { "role": "user", "content": "List all wallets holding the NFT with contract_address '0xabc123' and token_id '100' and the amount held." }, { "role": "assistant", "content": "SELECT wallet_address, amount\nFROM nft_holders\nWHERE contract_address = '0xabc123'\n AND token_id = '100';" }, { ...
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 NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ...
[ { "role": "user", "content": "Show me all service orders along with their status and the associated review comment for the same reservation, if there is one." }, { "role": "assistant", "content": "SELECT so.order_id, so.status, r.comment \nFROM hospitality_technology.service_orders so\nLEFT JOIN...
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.reservations ( reservation_id.text, property_id.text, guest_id.text, room_id.text, room_type_id....
[ { "role": "user", "content": "Count the number of logs for each action type." }, { "role": "assistant", "content": "SELECT action,\n COUNT(*) AS count\nFROM trading_platform.logs\nGROUP BY action;" } ]
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.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
[ { "role": "user", "content": "Show me all trips that were completed with vehicles manufactured after 2020, including the vehicle make and model." }, { "role": "assistant", "content": "SELECT t.trip_id, v.make, v.model FROM transportation.trips t JOIN transportation.vehicles v ON t.vehicle_id = v...
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": "Which hashtags appear on the most posts? Return hashtag_id, tag_name, and the number of posts each hashtag is used in, sorted descending, limited to the top 3." }, { "role": "assistant", "content": "SELECT\n h.hashtag_id,\n h.tag_name,\n COUNT(ph.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": "List each service category and the count of services that are currently available." }, { "role": "assistant", "content": "SELECT category,\n COUNT(*) AS available_service_count\nFROM hospitality_technology.services\nWHERE is_available = TRUE\nGROUP BY 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.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List usernames and the length of their 'bio' field for users whose 'is_verified' status is true." }, { "role": "assistant", "content": "SELECT username, LENGTH(bio) AS bio_length FROM social_media.users WHERE is_verified IS TRUE;" } ]
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": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 12 months, along with their token symbol and price from the token_basic_info table." }, { "role": "assistant", "content": "SELECT pfr.project_name, pfr.valuation, tbi.token_symbol,...
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 each contract address and the count of successful transactions sent to that contract." }, { "role": "assistant", "content": "SELECT c.address, COUNT(t.transaction_id) AS success_tx_count FROM web3.contracts c JOIN web3.transactions t ON t.to_address = c.address...
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": "How many documents are there for each document_type? Show document_type and count ordered by the count in descending order." }, { "role": "assistant", "content": "SELECT document_type,\n COUNT(*) AS count\nFROM legal_services.documents\nGROUP BY document_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 legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u...
[ { "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 users who registered with a Yahoo email address, along with their registration dates." }, { "role": "assistant", "content": "SELECT user_id, username, email, password_hash FROM blockchain.users WHERE email LIKE '%@yahoo.com';" }, { "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 blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic...
[ { "role": "user", "content": "Find all pairs of transactions where both transactions have the same nonce and from_address, but different transaction_id. Show both transaction IDs, the shared from_address, shared nonce, and their block numbers." }, { "role": "assistant", "content": "SELECT t1.tra...
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.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction fr...
[ { "role": "user", "content": "Find all users whose usernames contain numbers and have email addresses from either Gmail or Yahoo." }, { "role": "assistant", "content": "SELECT user_id, username, email FROM blockchain.users WHERE username ~ '[0-9]' AND (email LIKE '%@gmail.com' OR email LIKE '%@y...
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 text, ip_address text, port integer, last_seen timestamp ) CREATE TABLE blockchain.users ( ...
[ { "role": "user", "content": "Find the service locations that are not accessible and located in the state of 'California'. List their name, address, and city." }, { "role": "assistant", "content": "SELECT location_name , address , city FROM government_services.service_locations WHERE is_access...
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.service_locations ( location_id text, agency_id text, location_name text, address text, city text, ...
[ { "role": "user", "content": "List all Sui NFT collections where the owner is not null, including their name and collection_type, sorted by name in ascending order." }, { "role": "assistant", "content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL ORDER BY name ASC;" }, ...
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 me the top 5 users who have interacted with DApps, along with the count of distinct DApps they interacted with and their wallet addresses." }, { "role": "assistant", "content": "SELECT w.user_id, COUNT(DISTINCT d.dapp_id) AS dapp_count, w.address FROM trading_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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "Show me all users who have wallets but have never placed any orders, along with their wallet addresses and creation dates." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, w.address AS wallet_address, w.created_at FROM trading_platform.users u JOIN ...
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 character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "How many documents were uploaded in the year 2023?" }, { "role": "assistant", "content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;" } ]
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": "Find pairs of claims filed by the same customer where the incident dates are within 7 days of each other. Return customer_id, both claim IDs, and their incident dates." }, { "role": "assistant", "content": "SELECT c1.customer_id,\n c1.claim_id AS claim1_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 insurance.claims ( claim_id character varying(64) NOT NULL, -- unique identifier for the claim policy_id charac...
[ { "role": "user", "content": "List all ERC20 tokens where the price is greater than $100, including their names and symbols." }, { "role": "assistant", "content": "SELECT ti.name, ti.symbol FROM token_info ti JOIN token_prices tp ON ti.tick = tp.symbol WHERE tp.price > 100;" }, { "role":...
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 NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "How many patients are there in each gender category?" }, { "role": "assistant", "content": "SELECT gender,\n COUNT(*) AS patient_count\nFROM healthcare.patients\nGROUP BY gender;" }, { "role": "user", "content": "Limit this to categories with more ...
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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "Show me all insurance plans that have more than 5 patients enrolled, along with the provider name and count of patients, sorted by patient count in descending order." }, { "role": "assistant", "content": "SELECT i.plan_name, i.insurance_provider, COUNT(p.patient_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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "What is the detailed repair history of the equipment used by the staff with staff_id 'STAFF123' during maintenance tasks?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the detailed repair history of equipment used by staff memb...
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 train_station_management.m...
[ { "role": "user", "content": "Show the name of beneficiaries and the policy number for policies that are of product type 'life'." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.policy_number FROM insurance.policy_beneficiaries AS T1 JOIN insurance.policies AS T2 ON ...
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": "What are the training programs or certifications completed by a staff member with the role of Platform Supervisor?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to information about the training programs or certifications completed by sta...
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 train_station_management.s...
[ { "role": "user", "content": "Find all distinct pairs of customers having the same first_name but living in different cities. Display a.customer_id, a.first_name, a.city AS city_a, b.customer_id, b.city AS city_b." }, { "role": "assistant", "content": "SELECT a.customer_id AS customer_id_a,\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 financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Show me the count of unique email addresses among all passengers." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT email) AS unique_email_count\nFROM transportation.passengers;" }, { "role": "user", "content": "Instead, show a list of these 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 transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "List each driver's first_name, last_name, and the total number of bookings they have made." }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, COUNT(b.booking_id) AS booking_count\nFROM transportation.drivers d\nJOIN transportation.bookings b ON...
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, -- unique identifier for the driver employe...
[ { "role": "user", "content": "How many lawyers who are partners were hired in each year? Show the hire year and the count." }, { "role": "assistant", "content": "SELECT strftime('%Y', hire_date) AS hire_year , count(lawyer_id) FROM legal_services.lawyers WHERE is_partner = true GROUP BY hire_...
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": "Find all NFTs with a rarity rank less than 100 and show their name and the name of their collection." }, { "role": "assistant", "content": "SELECT nm.name AS nft_name, nc.name AS collection_name FROM nft_metadata nm JOIN nft_collections nc ON nm.contract_address = n...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch...
[ { "role": "user", "content": "For each guest, list reservation_id, guest_id, check_in_date, and the next reservation_id and its check_in_date." }, { "role": "assistant", "content": "SELECT r1.reservation_id,\n r1.guest_id,\n r1.check_in_date,\n r2.reservation_id AS next_reserva...
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.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ...
[ { "role": "user", "content": "Find all prescriptions for patients who have at least one appointment scheduled in the future. Show the prescription ID, patient ID, medication name, and the earliest future appointment time for that patient." }, { "role": "assistant", "content": "SELECT pr.prescrip...
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": "我想查看所有检查记录中检查员的ID和检查结果,同时统计每个检查员的检查次数。" }, { "role": "assistant", "content": "db.inspections.aggregate([\n {\n $group: {\n _id: '$inspector_employee_id',\n total_inspections: { $count: {} },\n results: { $push: '$result' }\n }\n },\n {\n $...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id...
[ { "role": "user", "content": "How many appointments were created in the last 24 hours?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM healthcare.appointments WHERE created_at >= NOW() - INTERVAL '24 hours';" } ]
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, patient_id character varying(64) NOT NULL, doc...
[ { "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": "Show me the top 5 tokens by USD value held on the Binance Smart Chain, along with their average price and total balance." }, { "role": "assistant", "content": "SELECT token_symbol, AVG(price) as average_price, SUM(balance) as total_balance, SUM(usd_value) as total_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 cex_token_balance ( snapshot_time text, chain text, address text, exchange text, token_address text, token_symbol text,...
[ { "role": "user", "content": "Could you list each game title along with the total number of players currently connected across all its servers?" }, { "role": "assistant", "content": "SELECT g.title, SUM(s.current_players) AS total_current_players FROM gaming_technology.games g JOIN 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.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "Find the diagnosis code and description for all non-chronic diagnoses for patient 'patient_789' made by doctor 'doctor_abc'." }, { "role": "assistant", "content": "SELECT diagnosis_code, description FROM healthcare.diagnoses WHERE patient_id = 'patient_789' AND doct...
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": "Can you help me get the total number of operational platforms across all stations?" }, { "role": "assistant", "content": "db.platforms.countDocuments({ status: 'Operational' });" } ]
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 // db.createCollection('platforms') // Optional: db.platforms.createIndex({ platform_id: 1 }, { u...
[ { "role": "user", "content": "Show all fuel refueling logs with the fuel_log_id, fuel_type, total_cost, and the name and city of the location where the fueling occurred." }, { "role": "assistant", "content": "SELECT f.fuel_log_id,\n f.fuel_type,\n f.total_cost,\n l.name AS loca...
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 the date worked, hours spent, and description for all time entries that have not yet been billed." }, { "role": "assistant", "content": "SELECT date_worked , hours_spent , description FROM time_entries WHERE is_billed = false" }, { "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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "List all medical records, showing the record ID, record date, and the full name of the doctor who created the record. Include the patient ID as well." }, { "role": "assistant", "content": "SELECT mr.record_id, mr.record_date, mr.patient_id, d.first_name, d.last_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 healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "List all public reviews from the past 30 days with the property name and overall rating." }, { "role": "assistant", "content": "SELECT r.review_id, p.property_name, r.rating_overall, r.review_date\nFROM hospitality_technology.reviews AS r\nJOIN hospitality_technolog...
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": "For each transaction, find the next transaction by the same sender. Show the original transaction_id as current_tx, the next transaction_id as next_tx, from_address, and the time difference in minutes between them." }, { "role": "assistant", "content": "SELECT t1.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 web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price...
[ { "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 tokens that have a positive price change percentage over the last 1 hour, 6 hours, and 24 hours. Display their symbol and chain." }, { "role": "assistant", "content": "SELECT token_symbol, chain FROM token_dexpool_info WHERE price_change_percentage_1h > 0 AND 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 token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "List the name and symbol for all assets that do not have a corresponding entry with the key 'website' in the metadata table." }, { "role": "assistant", "content": "SELECT T1.name , T1.symbol FROM trading_platform.assets AS T1 LEFT JOIN trading_platform.metadata AS 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.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Show all users whose full name starts with 'A' and who have updated their profile in June 2024. Please include their usernames and updated_at timestamps." }, { "role": "assistant", "content": "SELECT username, updated_at FROM social_media.users WHERE full_name ILIKE...
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": "Show me all users who have unread notifications about DApp updates, along with the notification message and DApp name." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, n.message, d.name AS dapp_name FROM trading_platform.users u JOIN trading_plat...
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 character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "List all vehicles and their last maintenance service date along with the odometer reading, including only those that have not had a fuel refill in the past 30 days." }, { "role": "assistant", "content": "SELECT m.vehicle_id,\n m.last_service_date,\n m.la...
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, route_number character varying(32) NOT NULL UNIQUE, de...
[ { "role": "user", "content": "List all passengers along with their ages and loyalty program membership status." }, { "role": "assistant", "content": "SELECT passenger_id, first_name, last_name, date_of_birth, loyalty_program_id, DATE_PART('year', AGE(current_date, date_of_birth)) AS age FROM tra...
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": "Show me all terminated drivers who had worked for the company for more than 5 years before termination." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, hire_date FROM transportation.drivers WHERE status = 'Terminated' AND (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 transportation.drivers ( driver_id character varying(64) NOT NULL, -- unique identifier for the driver employe...
[ { "role": "user", "content": "List all medications with a description that includes the word 'antibiotic'." }, { "role": "assistant", "content": "SELECT * FROM healthcare.medications WHERE description ILIKE '%antibiotic%';" } ]
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 PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd...
[ { "role": "user", "content": "I need to find all pairs of medications that share the same manufacturer. For each pair, show the first medication's ID and name, the second medication's ID and name, and the manufacturer." }, { "role": "assistant", "content": "SELECT m1.medication_id AS med1_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 healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text,...
[ { "role": "user", "content": "List the record ID, record date, and chief complaint for all medical records created by doctor 'doc_321' for patient 'pat_007'." }, { "role": "assistant", "content": "SELECT record_id, record_date, chief_complaint\nFROM healthcare.medical_records\nWHERE doctor_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 healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "I need a list of active drivers with their names and contact details." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, contact_number, email FROM transportation.drivers WHERE status = 'Active';" }, { "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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "List all employees who are currently active and were hired before 2022. Show employee_id, first_name, last_name, job_title, department, and hire_date." }, { "role": "assistant", "content": "SELECT\n employee_id,\n first_name,\n last_name,\n job_title,\n departm...
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": "Show me all reservations with more than 2 adults, along with their property names and room types." }, { "role": "assistant", "content": "SELECT r.reservation_id, p.property_name, rt.room_type_name, r.check_in_date, r.check_out_date, r.num_adults FROM hospitality_tec...
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": "For each claim, list the incident date, the policy number, and the number of beneficiaries associated with that policy." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, p.policy_number, COUNT(pb.beneficiary_id) AS beneficiary_count\nFROM 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 insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "List all service orders for spa services with their guest names and total prices, ordered by total price in descending order." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, so.order_id, so.total_price FROM hospitality_technology.service_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 hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ...
[ { "role": "user", "content": "For each vehicle, find pairs of maintenance logs where one log is immediately followed by another by service_date. List vehicle_id, previous log_id, next log_id, and the odometer increase." }, { "role": "assistant", "content": "SELECT\n vehicle_id,\n log_id AS pre...
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": "Find currently employed employees whose direct manager has been terminated. Display the employee's full name, hire date, manager's full name, and manager's termination date." }, { "role": "assistant", "content": "SELECT e.employee_id,\n CONCAT(e.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.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List all guests who have never left a review, including their full name and email." }, { "role": "assistant", "content": "SELECT g.guest_id, g.first_name, g.last_name, g.email \nFROM hospitality_technology.guests g \nLEFT JOIN hospitality_technology.reviews r ON g.g...
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": "Could you provide the total number of game sessions and the number of distinct players for each game genre? Display the genre, session count, and player count." }, { "role": "assistant", "content": "SELECT g.genre, COUNT(gs.session_id) AS session_count, COUNT(DISTIN...
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 NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show the total number of customers in each state." }, { "role": "assistant", "content": "SELECT\n state,\n COUNT(customer_id)\nFROM insurance.customers\nGROUP BY\n 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.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin...
[ { "role": "user", "content": "List users who have received notifications triggered by another user (non-system notifications). Show the recipient username, notification type, and the sender username." }, { "role": "assistant", "content": "SELECT T1.username AS recipient_username, T2.notification...
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": "For each chain, find the token with the highest price and the token with the lowest price. List chain, high_price_token, max_price, low_price_token, and min_price." }, { "role": "assistant", "content": "WITH max_prices AS (\n SELECT chain,\n token_symbol 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 token_dexpool_info (", "pair_address character varying(512) NOT NULL, -- the id of dexpool", "token_name cha...
[ { "role": "user", "content": "List all wallet addresses that hold SUI coins with a balance greater than 1,000,000. Please show the coin_type as well." }, { "role": "assistant", "content": "SELECT owner, coin_type, balance\nFROM sui_coins\nWHERE CAST(balance AS DECIMAL) > 1000000;" }, { "...
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 all events and any token transfers that occurred in the same transaction, showing event_id, event_name, transfer_id, and token_symbol." }, { "role": "assistant", "content": "SELECT\n e.event_id,\n e.event_name,\n tt.transfer_id,\n tk.token_symbol\nFROM 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.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "List pairs of distinct routes where the origin of one route is the destination of the other, and the destination of the first route is the origin of the second. Include the route IDs and numbers for both routes in each pair." }, { "role": "assistant", "content": "SE...
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": "Provide the contract ID, creator address, and timestamp for all smart contracts created between January 1st, 2022, and December 31st, 2024." }, { "role": "assistant", "content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE ti...
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.smart_contracts ( contract_id.text, creator_address.text, code.text, time...
[ { "role": "user", "content": "For the 'DeFi' narrative, what is the average ROI and the total net inflow (usd_value where type=1) from smart money token inflow?" }, { "role": "assistant", "content": "SELECT AVG(sm.roi) AS avg_roi, SUM(smt.usd_value) AS total_net_inflow\nFROM smart_money_token_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 token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri...
[ { "role": "user", "content": "What is the maintenance schedule for platform 3 at station DEF for the next month?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to the maintenance schedule for platforms. The data I have only includes static information about platform de...
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 train_station_management.p...
[ { "role": "user", "content": "Show me all pairs of clients that share the same phone area code, including each client’s first name, last name, and phone number." }, { "role": "assistant", "content": "SELECT c1.first_name AS first_name_1,\n c1.last_name AS last_name_1,\n c1.phone ...
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": "List all insurance products with their product name and base premium, where the product description contains the word 'accident'." }, { "role": "assistant", "content": "SELECT product_name, base_premium FROM insurance.insurance_products WHERE description ILIKE '%acc...
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": "What is the total commission earned from all trades executed in the 'NYSE' venue by employees in the 'Trading' department?" }, { "role": "assistant", "content": "SELECT SUM(t.commission) AS total_commission FROM financial_services.trades t JOIN financial_services.em...
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": "List the usernames and user IDs of all users whose bio contains the word 'developer'." }, { "role": "assistant", "content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';" } ]
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": "Show me the top 5 narratives by market cap, along with their top 3 coins and 24-hour trading volume." }, { "role": "assistant", "content": "SELECT narrative, top_3_coins, volume_24h FROM narrative_info ORDER BY market_cap DESC LIMIT 5;" }, { "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 narrative_info ( narrative character varying(512) NOT NULL, -- the id of narrative top_3_coins text, -- the top 3 token...
[ { "role": "user", "content": "I need the total amount and count of payments for each policy." }, { "role": "assistant", "content": "SELECT policy_id,\n COUNT(*) AS payment_count,\n SUM(amount_paid) AS total_paid\nFROM insurance.premium_payments\nGROUP BY policy_id;" }, { "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 insurance.premium_payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment po...
[ { "role": "user", "content": "How many documents have an expiry date within the next 30 days?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS document_count\nFROM government_services.documents\nWHERE expiry_date BETWEEN CURRENT_DATE AND (CURRENT_DATE + INTERVAL '30 days');" } ]
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": "Provide a count of notifications, separated by whether they have been read or not." }, { "role": "assistant", "content": "SELECT CASE WHEN T1.read_at IS NULL THEN 'Unread' ELSE 'Read' END, count(T1.notification_id) FROM trading_platform.notifications AS T1 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 trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp...