system
stringlengths
288
7.8k
conversations
listlengths
2
8
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ...
[ { "role": "user", "content": "List all customers (customer_id, first_name, last_name, email) who have a risk_profile of 'High' and an email address ending with '@gmail.com', along with their city and state information." }, { "role": "assistant", "content": "SELECT customer_id, first_name, last_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.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "Count the number of agents for each status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM insurance.agents GROUP BY status;" } ]
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the wallet user_...
[ { "role": "user", "content": "Give me all unspent UTXOs for address '1A2b3C4d5E', sorted by amount descending." }, { "role": "assistant", "content": "SELECT utxo_id, transaction_id, output_index, address, amount\nFROM trading_platform.utxos\nWHERE address = '1A2b3C4d5E' AND spent = FALSE\nORDER ...
You are an SQL statement expert. Given the table 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": "List all SUI coins with status 'exists', including their coin_type, balance, and owner address." }, { "role": "assistant", "content": "SELECT object_id, coin_type, balance, owner\nFROM sui_coins\nWHERE status = 'exists';" }, { "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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "Find overlapping appointments for each doctor. Return doctor_id, appointment_id_1, appointment_id_2, and overlap duration in minutes." }, { "role": "assistant", "content": "SELECT a.doctor_id,\n a.appointment_id AS appointment_id_1,\n b.appointment_id 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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "I want to retrieve the product_name, base_premium, and created_at from insurance_products where the description contains the word 'comprehensive'." }, { "role": "assistant", "content": "SELECT product_name,\n base_premium,\n created_at\nFROM insurance.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 gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region text, ip_address text, port integer,...
[ { "role": "user", "content": "List all servers that are currently marked with a 'offline' status." }, { "role": "assistant", "content": "SELECT server_id, server_name, region FROM gaming_technology.servers WHERE status = 'offline';" }, { "role": "user", "content": "For those offline ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir...
[ { "role": "user", "content": "Show me all terminated staff members along with their termination dates and the names of their managers, ordered by termination date." }, { "role": "assistant", "content": "SELECT s1.staff_id, s1.first_name, s1.last_name, s1.termination_date, s2.first_name AS manage...
You are an SQL statement expert. Given the table 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, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date...
[ { "role": "user", "content": "Could you list the title of each game and the total quantity of items acquired by players for that specific game?" }, { "role": "assistant", "content": "SELECT g.title, SUM(pi.quantity) AS total_acquired_quantity FROM gaming_technology.games g JOIN 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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Display each product alongside the most recently updated product of the same type. Return original_id, original_updated_at, recent_id, recent_updated_at, and product_type." }, { "role": "assistant", "content": "SELECT p.product_id AS original_id, p.updated_at AS ori...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "Show me a summary of customers with their total account balance and the count of accounts." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(a.account_id) AS account_count, SUM(a.balance) AS total_account_balance FROM financial_services....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb...
[ { "role": "user", "content": "How many active insurance policies are there for each plan_id? Show plan_id and active_count." }, { "role": "assistant", "content": "SELECT plan_id,\n COUNT(*) AS active_count\nFROM healthcare.patient_insurance\nWHERE expiration_date IS NULL OR expiration_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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "Find all pairs of contracts that were deployed on the same network. Show both contract IDs, the network ID, and the deployment timestamps for both contracts." }, { "role": "assistant", "content": "SELECT a.contract_id AS contract_id_1, b.contract_id AS contract_id_2...
You are an SQL statement expert. Given the table 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": "Which exchanges hold the largest total USD value of tokens on the BSC chain in the most recent snapshot, and what is the top token (by usd_value) held by each exchange?" }, { "role": "assistant", "content": "WITH latest_snapshot AS (\n SELECT MAX(snapshot_time) 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 hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i...
[ { "role": "user", "content": "List all active staff members (is_active = true) along with their position and hire date, ordered by hire date from newest to oldest." }, { "role": "assistant", "content": "SELECT first_name, last_name, position, hire_date FROM hospitality_technology.staff WHERE is_...
You are an SQL statement expert. Given the table 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 wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount." }, { "role": "assistant", "content": "SELECT eb.wallet_address, tm.symbol, eb.amount FROM erc20_balances_historical eb JOIN token_metas tm ON eb.contra...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(...
[ { "role": "user", "content": "For each user, find the previous user by registration time. List current user_id and username, previous user_id and username, and the time difference in minutes between their registrations." }, { "role": "assistant", "content": "SELECT u.user_id AS current_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 government_services.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, statu...
[ { "role": "user", "content": "List the application reference numbers, the corresponding message subjects, and the sent dates for notifications related to each application." }, { "role": "assistant", "content": "SELECT a.reference_number, n.message_subject, n.sent_at\nFROM government_services.app...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "role": "user", "content": "List lawyers who have any unbilled time entries. Show their first name, last name, and the count of their unbilled entries." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, COUNT(T2.entry_id) FROM lawyers AS T1 JOIN time_entries AS T2 ON T1...
You are an SQL statement expert. Given the table 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": "Can you list all group conversations and the number of participants in each?" }, { "role": "assistant", "content": "SELECT c.conversation_id, c.group_name, COUNT(cp.user_id) AS participant_count\nFROM social_media.conversations c\nJOIN social_media.conversation_part...
You are an SQL statement expert. Given the table 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, token_name character varying(100) NOT NULL, token_sy...
[ { "role": "user", "content": "What is the average price of tokens with a market cap over $100 million on the Ethereum chain?" }, { "role": "assistant", "content": "SELECT AVG(price) AS average_price FROM token_dexpool_info WHERE chain = 'Ethereum' AND market_cap > 100000000;" } ]
You are an SQL statement expert. Given the table 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 the average star rating for each property type in the USA." }, { "role": "assistant", "content": "SELECT property_type, AVG(star_rating) as avg_rating FROM hospitality_technology.properties WHERE country_code = 'US' GROUP BY property_type;" }, { "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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "Show me all policies where the total percentage share of beneficiaries exceeds 100%, along with the policy IDs and the sum of percentage shares." }, { "role": "assistant", "content": "SELECT policy_id, SUM(percentage_share) AS total_percentage FROM insurance.policy_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "Show the total number of contracts grouped by their status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS contract_count FROM web3.contracts GROUP BY status;" }, { "role": "user", "content": "Can you also filter to only include status...
You are an SQL statement expert. Given the table 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, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "List the usernames, emails, and group names for users who have sent messages in group chats and have enabled email notifications." }, { "role": "assistant", "content": "SELECT DISTINCT T1.username, T1.email, T4.group_name FROM social_media.users AS T1 JOIN social_me...
You are an SQL statement expert. Given the table 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": "Find all transactions where the from_address is the same as the to_address, indicating self-transactions, and show the transaction_id, value, and gas_used." }, { "role": "assistant", "content": "SELECT transaction_id, value, gas_used FROM web3.transactions WHERE fro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "List all rooms along with their room type name and features." }, { "role": "assistant", "content": "SELECT T1.room_number, T2.type_name, T1.features FROM rooms AS T1 JOIN room_types AS T2 ON T1.room_type_id = T2.room_type_id" }, { "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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Show me a list of users who have received notifications of type 'mention', along with their usernames and the notification creation time." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, n.notification_id, n.created_at\nFROM social_media.users 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.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "Show me the first name, last name, and email address for all passengers who are part of the loyalty program with ID 'Gold'." }, { "role": "assistant", "content": "SELECT first_name , last_name , email FROM transportation.passengers WHERE loyalty_program_id = 'Go...
You are an SQL statement expert. Given the table 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": "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 insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "List the product_id, product_name, and base_premium for all products that are currently inactive." }, { "role": "assistant", "content": "SELECT product_id, product_name, base_premium\nFROM insurance.insurance_products\nWHERE 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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "I need a report of all notification messages sent to users who have at least one wallet, showing the notification message and the address of one wallet for each user." }, { "role": "assistant", "content": "SELECT n.message, w.address\nFROM trading_platform.notificat...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, property_id text, guest_id text, room_id text, r...
[ { "role": "user", "content": "Show the total payment amount per currency for payments that are either 'Pending' or 'Failed', grouped by currency_code." }, { "role": "assistant", "content": "SELECT currency_code, SUM(amount) AS total_payment_amount\nFROM hospitality_technology.payments\nWHERE sta...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Retrieve the usernames and email addresses of users who updated their profiles in the last 30 days." }, { "role": "assistant", "content": "SELECT username, email\nFROM social_media.users\nWHERE updated_at >= NOW() - 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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text...
[ { "role": "user", "content": "List all smart contracts created by addresses that have a balance greater than 1000." }, { "role": "assistant", "content": "SELECT sc.* FROM blockchain.smart_contracts sc JOIN blockchain.addresses a ON sc.creator_address = a.address_id WHERE a.balance > 1000;" }, ...
You are an SQL statement expert. Given the table 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.reviews ( review_id text, property_id text, reservation_id text, guest_id text, rating_overall i...
[ { "role": "user", "content": "Show me each staff member by response_staff_id and the number of unique guests whose reviews they have responded to." }, { "role": "assistant", "content": "SELECT response_staff_id, COUNT(DISTINCT guest_id) AS unique_guest_count\nFROM hospitality_technology.reviews\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Which developers have at least one player who unlocked an achievement on a game they developed?" }, { "role": "assistant", "content": "SELECT DISTINCT d.developer_id, d.name\nFROM gaming_technology.developers d\nJOIN gaming_technology.games g ON d.developer_id = g.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 hospitality_technology.services ( service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ...
[ { "role": "user", "content": "Show me all services along with their property names." }, { "role": "assistant", "content": "SELECT s.service_id, s.service_name, p.property_name\nFROM hospitality_technology.services s\nJOIN hospitality_technology.properties p ON s.property_id = p.property_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.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l...
[ { "role": "user", "content": "Find all agents with their managers where the agent's commission rate is above 0.10." }, { "role": "assistant", "content": "SELECT a.agent_id,\n a.first_name || ' ' || a.last_name AS agent_name,\n m.agent_id AS manager_id,\n m.first_name || ' ' || ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "List all transactions together with any event emitted in the same transaction, showing transaction ID, event name, and event emitted timestamp." }, { "role": "assistant", "content": "SELECT tx.transaction_id, ev.event_name, ev.emitted_at\nFROM web3.transactions tx\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti...
[ { "role": "user", "content": "Show me all in-progress trips with their vehicle IDs and the difference between scheduled and actual departure time in minutes." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, EXTRACT(EPOCH FROM (actual_departure - scheduled_departure))/60 AS depa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, bas...
[ { "role": "user", "content": "Which active insurance products contain the word 'comprehensive' or 'premium' in their description? List their product IDs, product names, types, and base premiums." }, { "role": "assistant", "content": "SELECT product_id, product_name, product_type, base_premium\nF...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ...
[ { "role": "user", "content": "Provide a count of locations for each country listed in the table." }, { "role": "assistant", "content": "SELECT country, COUNT(*) FROM transportation.locations GROUP BY country" } ]
You are an SQL statement expert. Given the table 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": "Which players have played sessions on more than one distinct game? Show their player_id, username, and the number of unique games they've played." }, { "role": "assistant", "content": "SELECT p.player_id, p.username, COUNT(DISTINCT gs.game_id) AS unique_games_played...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu...
[ { "role": "user", "content": "Show me all time entries for case ID 'case_abc', including the entry ID, date worked, hours spent, and the first and last name of the lawyer." }, { "role": "assistant", "content": "SELECT te.entry_id, te.date_worked, te.hours_spent, l.first_name, l.last_name FROM le...
You are an SQL statement expert. Given the table 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": "List all maintenance logs for vehicles that had 'Oil Change' service in the last 3 months, showing vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_typ...
You are an SQL statement expert. Given the table 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": "Which diagnosis codes have been used for more than 5 different patients? Show the diagnosis_code and the patient count." }, { "role": "assistant", "content": "SELECT diagnosis_code, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.diagnoses GROUP BY diagn...
You are an SQL statement expert. Given the table 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 each user's username along with their total traded value as buyers and their total traded value as sellers for trades executed in June 2024." }, { "role": "assistant", "content": "SELECT u.username,\n COALESCE(buy_tot.buy_value, 0) AS buyer_value,\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 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 average ROI for smart money addresses on the Binance chain?" }, { "role": "assistant", "content": "SELECT AVG(roi) FROM smart_money_profit WHERE chain = 'Binance';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date...
[ { "role": "user", "content": "List all invoices with status 'Paid' where the payment date is later than the due date, showing the invoice number, issue date, due date, payment date, total amount, and amount paid." }, { "role": "assistant", "content": "SELECT invoice_number, issue_date, due_date,...