conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "For each game, count the total number of achievements unlocked across all players. Show game title and count." }, { "role": "assistant", "content": "SELECT g.title, COUNT(pa.player_achievement_id) AS total_unlocked_achievements FROM gaming_technology.games AS g 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "For each citizen who has made a payment for an application that is still in 'Processing' status, list their full name, application_id, payment_id, amount, currency, and the application status." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Find all pairs of overlapping reservations for the same room. Show the two reservation IDs, room_id, and both reservations' check-in and check-out dates." }, { "role": "assistant", "content": "SELECT r1.reservation_id AS reservation1_id, r2.reservation_id AS 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": "Show me all customers who have missing contact information (either phone number or email is null), along with their state and city." }, { "role": "assistant", "content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone_number IS NULL O...
You are an SQL statement expert. Given the table 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, -- unique identifier for the customer first_...
[ { "role": "user", "content": "List all cryptocurrency assets that have been traded more than 50 times, along with their total trade volume and average price." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, COUNT(t.trade_id) AS trade_count, SUM(t.quantity * t.price) AS total_vol...
You are an SQL statement expert. Given the table 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": "List all active staff members who are managers, along with their hire dates and email addresses." }, { "role": "assistant", "content": "SELECT staff_id, first_name, last_name, position, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Find pairs of distinct token transfers that occurred in the same transaction and were initiated by the same sender address. List the transaction ID, the common sender address, and both transfer IDs." }, { "role": "assistant", "content": "SELECT\n t1.transaction_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 web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer token...
[ { "role": "user", "content": "For each passenger, find the next older passenger by date_of_birth, showing the younger passenger's ID, birth date, the older passenger's ID, and birth date." }, { "role": "assistant", "content": "SELECT p_young.passenger_id AS younger_id, p_young.date_of_birth AS 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 transportation.passengers ( passenger_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "List the ticker and creator for all tokens recorded in the `token_info_avalanche` table." }, { "role": "assistant", "content": "SELECT tick, creator FROM token_info_avalanche" }, { "role": "user", "content": "Now, for these tokens, show their latest pric...
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 erc20_balances_historical ( block_number.bigint, contract_address.text, wallet_addre...
[ { "role": "user", "content": "Show me the list of all room numbers and their corresponding guest full names for current reservations (status is 'Occupied' or 'CheckedIn')." }, { "role": "assistant", "content": "SELECT r.room_number, g.first_name || ' ' || g.last_name AS guest_full_name\nFROM hos...
You are an SQL statement expert. Given the table 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": "Show me all users who have wallets but have never placed any orders, along with their wallet creation dates." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, w.wallet_id, w.created_at FROM trading_platform.users u JOIN trading_platform.wallets 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 trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Which documents have a description that includes the word 'settlement'? Please provide the document name, case ID, and description." }, { "role": "assistant", "content": "SELECT document_name, case_id, description \nFROM legal_services.documents \nWHERE 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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "Display the details of all UTXOs with a 'spent' status of false." }, { "role": "assistant", "content": "SELECT utxo_id, transaction_id, output_index, address, amount FROM trading_platform.utxos WHERE spent = false;" }, { "role": "user", "content": "For t...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text...
[ { "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": "Which players have unlocked any achievement?" }, { "role": "assistant", "content": "SELECT DISTINCT player_id FROM player_achievements;" }, { "role": "user", "content": "Show me the player ID and the total number of points they've accumulated from all un...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points....
[ { "role": "user", "content": "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, r.room_type_id, r.num_adults FROM hospitality_technology.reservations r JOIN hospitalit...
You are an SQL statement expert. Given the table 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": "Find all pairs of wallets that share the same address_id but belong to different users." }, { "role": "assistant", "content": "SELECT\n w1.wallet_id AS wallet1,\n w1.user_id AS user1,\n w2.wallet_id AS wallet2,\n w2.user_id AS user2,\n w1.address_id\nFROM b...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address_id chara...
[ { "role": "user", "content": "For each case, show its name, case number, the total hours worked by all lawyers, and the name of the client associated with the case." }, { "role": "assistant", "content": "SELECT c.case_name, c.case_number, SUM(te.hours_spent) AS total_hours, cl.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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List conversation_id, user_id, and post_id for participants whose user_id is also used as a hashtag_id." }, { "role": "assistant", "content": "SELECT cp.conversation_id, cp.user_id, ph.post_id\nFROM social_media.conversation_participants cp\nINNER JOIN social_media....
You are an SQL statement expert. Given the table 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.post_hashtags ( post_hashtag_id.text, post_id.text, hashtag_id.text ) CREATE TABLE social_media.conversati...
[ { "role": "user", "content": "List all patients who have been diagnosed with chronic conditions, including their diagnosis descriptions and dates." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, d.diagnosis_description, d.diagnosis_date FROM healthcare.pati...
You are an SQL statement expert. Given the table 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": "Which narratives have both a positive 1-hour and 24-hour price change percentage? Show the narrative name, the 1h change, and the 24h change." }, { "role": "assistant", "content": "SELECT narrative, price_change_percentage_1h, price_change_percentage_24h FROM narrat...
You are an SQL statement expert. Given the table 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 text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume...
[ { "role": "user", "content": "Show me all rooms that were last cleaned more than 3 days ago, along with their room numbers and cleaning status." }, { "role": "assistant", "content": "SELECT room_number, status FROM hospitality_technology.rooms WHERE last_cleaned_at < CURRENT_TIMESTAMP - 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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "For each player, count the total number of achievements they've unlocked." }, { "role": "assistant", "content": "SELECT player_id,\n COUNT(*) AS total_achievements\nFROM gaming_technology.player_achievements\nGROUP BY player_id;" }, { "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 gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id...
[ { "role": "user", "content": "Find all pairs of contracts deployed by the same deployer on the same day, showing the deployer_address, the deployment date, and both contract IDs." }, { "role": "assistant", "content": "SELECT c1.deployer_address,\n DATE(c1.deployed_at) AS deploy_date,\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 web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Can you show the driver first name, last name, and the make and model of the vehicle for each trip, along with the scheduled departure time?" }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, v.make, v.model, t.scheduled_departure\nFROM transpo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "List the number of users created each year, showing the year and the count, ordered by the year." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM created_at) AS creation_year, COUNT(*) FROM web3.users GROUP BY creation_year ORDER BY creation_year;" ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at...
[ { "role": "user", "content": "Find all medical records where the treatment plan includes 'physical therapy' and the patient has an active primary insurance plan, showing the patient ID, record date, and insurance provider details." }, { "role": "assistant", "content": "SELECT mr.patient_id, mr.r...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Get the number of distinct wallet holders and total amount held for each NFT collection on Ethereum. Include collection name and contract_address." }, { "role": "assistant", "content": "SELECT nc.contract_address, nc.name, COUNT(DISTINCT nh.wallet_address) AS holder...
You are an SQL statement expert. Given the table 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": "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": "List all patient insurance entries where the subscriber name is different from the patient's last name. Include patient ID, subscriber name, and patient last name." }, { "role": "assistant", "content": "SELECT T1.patient_id, T1.subscriber_name, T2.last_name FROM 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 character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List all unavailable services along with their names, prices, and the departments they belong to." }, { "role": "assistant", "content": "SELECT service_name, price, department FROM hospitality_technology.services WHERE is_available = false;" }, { "role": "us...
You are an SQL statement expert. Given the table 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, property_id.text, service_name.text, description.text, category.text...
[ { "role": "user", "content": "What is the current number of passengers at station with ID 'ST123' right now?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the current number of passengers at a station. The data I have access to only includes static details ...
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": "List the item_id, item_name, cost_amount, game title, and developer name for all items with rarity = 'Rare'." }, { "role": "assistant", "content": "SELECT i.item_id,\n i.item_name,\n i.cost_amount,\n g.title,\n d.name\nFROM gaming_technology....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "Find pairs of beneficiaries on the same policy who were added on the exact same date. Show policy_id, beneficiary1_id, beneficiary2_id, and the added_at date." }, { "role": "assistant", "content": "SELECT T1.policy_id, T1.beneficiary_id AS beneficiary1_id, T2.benefi...
You are an SQL statement expert. Given the table 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": "How many beneficiaries are there for each relationship type?" }, { "role": "assistant", "content": "SELECT relationship,\n COUNT(*) AS beneficiary_count\nFROM insurance.policy_beneficiaries\nGROUP BY relationship;" } ]
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, policy_id character varying(64) NOT NUL...
[ { "role": "user", "content": "Calculate the average total amount and average amount paid for reservations grouped by booking source." }, { "role": "assistant", "content": "SELECT booking_source, AVG(total_amount) AS avg_total_amount, AVG(amount_paid) AS avg_amount_paid FROM 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.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ...
[ { "role": "user", "content": "For each achievement, list how many unique players have unlocked it." }, { "role": "assistant", "content": "SELECT achievement_id, COUNT(DISTINCT player_id) AS unique_players FROM gaming_technology.player_achievements GROUP BY achievement_id;" }, { "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 gaming_technology.player_achievements ( player_achievement_id.uuid, player_id.uuid, achievement_id.uuid, unlocked_at.ti...
[ { "role": "user", "content": "List all trips along with their trip ID and the number of passengers if the trip is currently in progress." }, { "role": "assistant", "content": "SELECT trip_id, passenger_count FROM transportation.trips WHERE status = 'In Progress';" }, { "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.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti...
[ { "role": "user", "content": "Show me all claims with police reports that were filed in the last 3 months, along with the policy details and customer information." }, { "role": "assistant", "content": "SELECT c.claim_id, c.policy_id, c.customer_id, c.incident_date, c.reported_date, c.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 insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "Get me all unbilled billable time entries with their entry_id, case_id, lawyer_id, hours_spent, and billing_rate." }, { "role": "assistant", "content": "SELECT entry_id,\n case_id,\n lawyer_id,\n hours_spent,\n billing_rate\nFROM legal_servic...
You are an SQL statement expert. Given the table 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.time_entries ( entry_id character varying(64) NOT NULL, -- unique identifier for the time entry ...
[ { "role": "user", "content": "List all ERC20 tokens with their names and symbols where the price is greater than $10, sorted by price in descending order." }, { "role": "assistant", "content": "SELECT t.symbol, t.name, p.price FROM sui_coins_metadata t JOIN token_prices_latest p ON t.coin_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 erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "Give me the count of clients who registered in each month of 2023." }, { "role": "assistant", "content": "SELECT TO_CHAR(date_registered, 'YYYY-MM') AS reg_month, COUNT(*) AS client_count FROM legal_services.clients WHERE date_registered BETWEEN '2023-01-01' AND '20...
You are an SQL statement expert. Given the table 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 the number of applications submitted by each citizen." }, { "role": "assistant", "content": "SELECT c.citizen_id, c.first_name, c.last_name, COUNT(a.application_id) AS application_count\nFROM government_services.citizens c\nLEFT JOIN government_services.applica...
You are an SQL statement expert. Given the table 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": "List the license number and specialty for all doctors who have a phone number on record." }, { "role": "assistant", "content": "SELECT license_number, specialty FROM healthcare.doctors WHERE phone_number IS NOT 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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List each employee's first_name, last_name, and the number of documents they've verified. Include employees with zero verifications as well." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, COUNT(d.document_id) AS verified_count\nFROM governm...
You are an SQL statement expert. Given the table 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.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eli...
[ { "role": "user", "content": "Show the usernames and emails of all users who registered on the same day as at least one other user, along with the registration date." }, { "role": "assistant", "content": "SELECT u1.username, u1.email, u1.created_at\nFROM web3.users u1\nJOIN web3.users u2\n ON 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 web3.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
[ { "role": "user", "content": "List all cancelled policies with their cancellation reasons and premium amounts." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, cancellation_reason, premium_amount FROM insurance.policies WHERE status = 'Cancelled';" }, { "role": "us...
You are an SQL statement expert. Given the table 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, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "Show me the usernames and the group names of group chats where each user has posted at least one post containing a hashtag." }, { "role": "assistant", "content": "SELECT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.posts p ON u.user_id = 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 social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t...
[ { "role": "user", "content": "What is the total amount invoiced per status?" }, { "role": "assistant", "content": "SELECT status,\n SUM(total_amount) AS total_invoiced\nFROM legal_services.invoices\nGROUP BY status;" }, { "role": "user", "content": "Only include statuses 'Paid'...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice invo...
[ { "role": "user", "content": "List all patients who have been prescribed medications with dosage greater than 100mg, including their names and the medication details." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, m.medication_name, m.generic_name, pr.dosage FROM health...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me the first and last names of citizens along with their dates of birth and contact emails for all citizens who registered after January 1, 2023." }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth, contact_email FROM government_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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Get all hashtags that were created after the hashtag with ID 'H100', showing their ID, name, and creation time." }, { "role": "assistant", "content": "SELECT h2.hashtag_id, h2.tag_name, h2.created_at\nFROM social_media.hashtags h1\nJOIN social_media.hashtags h2\n O...
You are an SQL statement expert. Given the table 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": "For each employee who acts as a manager, please show the number of employees directly reporting to them." }, { "role": "assistant", "content": "SELECT m.first_name || ' ' || m.last_name AS manager_name, COUNT(e.employee_id) AS direct_report_count FROM financial_serv...
You are an SQL statement expert. Given the table 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": "List all narratives with a positive 7-day price change. Include the narrative and the 7-day change." }, { "role": "assistant", "content": "SELECT narrative, price_change_percentage_7d FROM narrative_info WHERE price_change_percentage_7d > 0;" } ]
You are an SQL statement expert. Given the table 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, top_3_coins text, price_change_percentage_1h double precisi...
[ { "role": "user", "content": "How many service orders were placed by each staff member (staff_id_ordered)? Show the staff ID and the count." }, { "role": "assistant", "content": "SELECT staff_id_ordered, COUNT(*) FROM hospitality_technology.service_orders GROUP BY staff_id_ordered;" }, { ...
You are an SQL statement expert. Given the table 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.service_orders ( order_id text, reservation_id text, guest_id text, service_id text, staff_id_or...
[ { "role": "user", "content": "Show the first name, last name, and position of all staff members who are not currently active." }, { "role": "assistant", "content": "SELECT first_name , last_name , position FROM hospitality_technology.staff WHERE is_active = false" } ]
You are an SQL statement expert. Given the table 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 service location in Texas, provide the location name, city, and the number of appointments scheduled there by verified citizens." }, { "role": "assistant", "content": "SELECT sl.location_name, sl.city, COUNT(a.appointment_id) AS appointment_count\nFROM gove...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Show item_id, item_name, and the damage attribute extracted from attributes JSON for items of type 'Weapon'." }, { "role": "assistant", "content": "SELECT item_id,\n item_name,\n (attributes->>'damage')::numeric AS damage\nFROM gaming_technology.in_game_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "For each token_id, what is the average value of transfers? Show token_id and avg_value." }, { "role": "assistant", "content": "SELECT token_id, AVG(value) AS avg_value\nFROM web3.token_transfers\nGROUP BY token_id;" }, { "role": "user", "content": "Actua...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the transfer token...
[ { "role": "user", "content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and belong to the 'Healthcare' sector, along with their last_updated timestamp." }, { "role": "assistant", "content": "SELECT security_id, ticker_symbol, security_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.securities ( security_id character varying(64) NOT NULL, ticker_symbol character varying(20) NOT NUL...
[ { "role": "user", "content": "Show me all smart contracts created by addresses that have created more than 3 contracts, along with the total number of contracts each creator has made." }, { "role": "assistant", "content": "SELECT sc.contract_id, sc.creator_address, COUNT(*) OVER (PARTITION BY 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 blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
[ { "role": "user", "content": "How many documents are set to expire in the year 2025?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS document_count\nFROM government_services.documents\nWHERE expiry_date >= '2025-01-01' AND expiry_date < '2026-01-01';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, -- unique identifier for the agency ag...
[ { "role": "user", "content": "List all inactive customers from Texas who were created in the last 2 years, showing their full names and creation dates." }, { "role": "assistant", "content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'Texas' AND status = 'ina...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Which addresses have both sent and received tokens? List them." }, { "role": "assistant", "content": "SELECT DISTINCT t1.from_address FROM web3.token_transfers t1 INNER JOIN web3.token_transfers t2 ON t1.from_address = t2.to_address;" }, { "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 web3.token_transfers ( transfer_id text, token_id text, from_address text, to_address text, value numeric, transaction_...
[ { "role": "user", "content": "List each branch_id, the number of employees in that branch, and the number of securities that trade on that branch's exchange." }, { "role": "assistant", "content": "SELECT e.branch_id,\n COUNT(DISTINCT e.employee_id) AS employee_count,\n COUNT(s.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.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu...
[ { "role": "user", "content": "List all properties located in the USA with a star rating of 4.0 or higher, along with their city and property type." }, { "role": "assistant", "content": "SELECT property_name, city, property_type, star_rating FROM hospitality_technology.properties WHERE country_co...
You are an SQL statement expert. Given the table 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": "How many notifications have been sent per channel?" }, { "role": "assistant", "content": "SELECT channel,\n COUNT(*) AS notification_count\nFROM government_services.notifications\nGROUP BY channel;" }, { "role": "user", "content": "Exclude any noti...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_sub...
[ { "role": "user", "content": "Find all pairs of distinct medications manufactured by the same company, showing med1.medication_id, med1.medication_name, med2.medication_id, med2.medication_name, and the manufacturer." }, { "role": "assistant", "content": "SELECT m1.medication_id AS med1_id, m1.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 healthcare.medications ( medication_id.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,...
[ { "role": "user", "content": "List all SUI coins with 'active' status and their object_id, owner address, coin_type, and balance." }, { "role": "assistant", "content": "SELECT object_id, owner, coin_type, balance FROM sui_coins WHERE status = 'active';" }, { "role": "user", "content"...
You are an SQL statement expert. Given the table 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 me all users whose email address contains the word 'test', along with their user IDs and the date they registered." }, { "role": "assistant", "content": "SELECT user_id, username, email, created_at FROM trading_platform.users WHERE email ILIKE '%test%';" }, ...
You are an SQL statement expert. Given the table 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": "Count the number of prescriptions each doctor has written for medications manufactured by 'Pfizer' in the last 6 months." }, { "role": "assistant", "content": "SELECT p.doctor_id, COUNT(*) AS prescription_count\nFROM healthcare.prescriptions p\nJOIN healthcare.medic...
You are an SQL statement expert. Given the table 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": "Can you help me count the total number of active staff members in the database?" }, { "role": "assistant", "content": "db.staff.countDocuments({ is_active: true });" } ]
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('stations') // Optional: Add unique index: db.stations.createIndex({ stati...
[ { "role": "user", "content": "For each transaction ID, provide a count of unspent UTXOs." }, { "role": "assistant", "content": "SELECT transaction_id, COUNT(*) FROM utxos WHERE spent = FALSE GROUP BY transaction_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 trading_platform.utxos ( utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO transaction...
[ { "role": "user", "content": "List all transaction IDs that contain at least one UTXO marked as spent." }, { "role": "assistant", "content": "SELECT DISTINCT transaction_id FROM utxos WHERE spent = TRUE;" }, { "role": "user", "content": "Now, for those transaction IDs, also include 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.utxos ( utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO transaction...
[ { "role": "user", "content": "For each route, show the route number and the total number of trips associated with it." }, { "role": "assistant", "content": "SELECT T2.route_number, count(T1.trip_id) FROM transportation.trips AS T1 JOIN transportation.routes AS T2 ON T1.route_id = T2.route_id 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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Show me a list of users who have logged any action. Include their user ID and username." }, { "role": "assistant", "content": "SELECT DISTINCT u.user_id, u.username FROM users u JOIN logs l ON u.user_id = l.user_id;" }, { "role": "user", "content": "For ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, passwo...
[ { "role": "user", "content": "Show me all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a daily trading volume exceeding 1 million shares, along with the employee details (employee_id, first_name, last_name) who last updated these securities." }, ...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "List each patient along with the patient record whose phone_number matches that patient's emergency_contact_phone. Show patient_id, first_name, and matched contact patient_id." }, { "role": "assistant", "content": "SELECT p.patient_id AS patient_id, p.first_name 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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "For each post, show the number of different users who have commented on it, along with the post_id." }, { "role": "assistant", "content": "SELECT post_id, COUNT(DISTINCT user_id) AS unique_commenters\nFROM social_media.comments\nGROUP BY post_id;" }, { "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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Show me the total number of properties in each country." }, { "role": "assistant", "content": "SELECT country_code, COUNT(*) AS total_properties FROM hospitality_technology.properties GROUP BY country_code;" }, { "role": "user", "content": "Now, filter 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "How many drivers and passengers have email addresses ending with 'company.com'? Return the count for each group." }, { "role": "assistant", "content": "SELECT 'drivers' AS role, COUNT(*) AS count\nFROM transportation.drivers\nWHERE email LIKE '%@company.com'\nUNION ...
You are an SQL statement expert. Given the table 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": "Find all pairs of policies for the same customer where their coverage periods overlap. Show customer_id, policy1_id, policy2_id, overlap_start, and overlap_end." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_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 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 loans (loan_id, loan_type, principal_amount) where the current principal balance is less than 30% of the original principal amount, along with their account_id and status." }, { "role": "assistant", "content": "SELECT loan_id, loan_type, principal_amount...
You are an SQL statement expert. Given the table 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": "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 PRIMARY KEY, vehicle_id text, service_date date, odometer_reading int, se...
[ { "role": "user", "content": "For each route, list the route number, description, and the combined total maintenance cost for all vehicles that have ever operated on that route." }, { "role": "assistant", "content": "WITH VehicleTotalMaintenance AS ( SELECT vehicle_id, SUM(cost) AS total_cost FR...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Show the first name and last name of customers along with the payment method for all their premium payments." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.payment_method FROM insurance.customers AS T1 JOIN insurance.premium_payments 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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Show me 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": "Find pairs of routes where the destination of one route matches the origin of another. Show the first_route_number, first_description, second_route_number, and second_description." }, { "role": "assistant", "content": "SELECT r1.route_number AS first_route_number, r...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, -- unique identifier for the route route_numb...
[ { "role": "user", "content": "For 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": "Show me all addresses that have created smart contracts, along with their balance and the count of contracts they've created." }, { "role": "assistant", "content": "SELECT a.address_id, a.balance, COUNT(sc.contract_id) AS contract_count FROM blockchain.addresses a J...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text...
[ { "role": "user", "content": "Show me the total transaction amount sent by each user (based on user_id) in the last 30 days, along with their username." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, SUM(t.amount) AS total_amount FROM blockchain.users u JOIN blockchain.walle...
You are an SQL statement expert. Given the table 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": "List all ERC20 tokens with their contract address, symbol, name, and latest USD price." }, { "role": "assistant", "content": "SELECT tm.contract_address, tm.symbol, tm.name, tpl.price\nFROM token_metas tm\nJOIN token_prices_latest tpl ON tm.contract_address = tpl.ad...
You are an SQL statement expert. Given the table 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 number of approval-for-all events for each ERC1155 contract in the erc1155_approval_for_all table." }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_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 erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "Can you list all billable and non-billable entry pairs for the same lawyer on the same date?" }, { "role": "assistant", "content": "SELECT b.lawyer_id,\n b.date_worked,\n b.entry_id AS billable_entry,\n n.entry_id AS non_billable_entry,\n b.d...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billi...
[ { "role": "user", "content": "Find the average percentage share among all beneficiaries for each distinct relationship type." }, { "role": "assistant", "content": "SELECT relationship, AVG(percentage_share) FROM insurance.policy_beneficiaries GROUP BY relationship ORDER BY relationship;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "List all patients who have had appointments and were prescribed a medication manufactured by 'Merck'. Show the patient ID, full name, appointment ID, and medication name." }, { "role": "assistant", "content": "SELECT DISTINCT p.patient_id, p.first_name, p.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.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Show the tokens with a negative net flow this month on all chains." }, { "role": "assistant", "content": "SELECT token_symbol, chain, net_flow FROM smart_money_token_performance WHERE net_flow < 0 AND date_trunc('month', CURRENT_DATE) = date_trunc('month', now());" ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl...
[ { "role": "user", "content": "How many users does each user follow? Show the follower user ID and the count." }, { "role": "assistant", "content": "SELECT follower_user_id, count(*) FROM social_media.follows GROUP BY follower_user_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 social_media.follows ( follow_id text, follower_user_id text, following_user_id text, created_at timestamp )
[ { "role": "user", "content": "List all assets that have 'category' metadata. Show the asset ID and the value of the 'category'." }, { "role": "assistant", "content": "SELECT asset_id, value AS category FROM trading_platform.metadata WHERE key = 'category';" }, { "role": "user", "cont...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "Show me the top 5 tokens by 24-hour trading volume on the Ethereum chain, along with their price and 24-hour price change percentage from the token_dexpool_info table." }, { "role": "assistant", "content": "SELECT token_symbol, price, price_change_percentage_24h, vo...
You are an SQL statement expert. Given the table 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, token_name character varying(100) NOT NULL, token_symbol ch...