conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Calculate the average realized_ratio across all addresses." }, { "role": "assistant", "content": "SELECT AVG(realized_ratio) AS average_realized_ratio\nFROM smart_money_profit;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_profit ( address character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres...
[ { "role": "user", "content": "For each player, show the player_id and the count of inventory items they acquired with a quantity greater than 1." }, { "role": "assistant", "content": "SELECT player_id, COUNT(inventory_id) AS items_qty_gt_1_count FROM gaming_technology.player_inventory WHERE quan...
You are an SQL statement expert. Given the table 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 trip that has bookings, show the trip ID and the total number of bookings associated with it." }, { "role": "assistant", "content": "SELECT T.trip_id, COUNT(B.booking_id) AS booking_count FROM transportation.trips AS T JOIN transportation.bookings AS B ON 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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati...
[ { "role": "user", "content": "Show photo claim documents uploaded in the last 7 days, including document_id, claim_id, file_name, uploaded_at, and the customer's full name." }, { "role": "assistant", "content": "SELECT cd.document_id,\n cd.claim_id,\n cd.file_name,\n cd.uploade...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "List the full names and hire dates of all employees who report directly to a manager with the job title 'Director'." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, e.hire_date\nFROM government_services.employees e\nJOIN government_services.e...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, depa...
[ { "role": "user", "content": "Show all appointments with subject containing 'Review' and their corresponding case_id." }, { "role": "assistant", "content": "SELECT appointment_id, subject, case_id\nFROM legal_services.appointments\nWHERE subject ILIKE '%Review%';" } ]
You are an SQL statement expert. Given the table 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": "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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "List all comment IDs and their content for comments made by users who have 'dark' as their theme." }, { "role": "assistant", "content": "SELECT c.comment_id, c.content\nFROM social_media.comments c\nJOIN social_media.user_settings s ON c.user_id = s.user_id\nWHERE 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 social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "For each user, show their username and the total number of completed orders they have placed, along with the name of the asset for each order." }, { "role": "assistant", "content": "SELECT u.username, a.name AS asset_name, COUNT(o.order_id) AS completed_order_count\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp ) CREATE TAB...
[ { "role": "user", "content": "Can you show me the number of servers in each region, as well as the total max_players for each region?" }, { "role": "assistant", "content": "SELECT region, COUNT(*) AS server_count, SUM(max_players) AS total_max_players FROM gaming_technology.servers GROUP BY regi...
You are an SQL statement expert. Given the table 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": "Show each player's total session count and the date of their earliest acquired inventory item." }, { "role": "assistant", "content": "SELECT gs.player_id,\n COUNT(gs.session_id) AS session_count,\n MIN(pi.acquired_at) AS first_item_date\nFROM gaming_tech...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, game_id ...
[ { "role": "user", "content": "List pairs of distinct locations in the same city that share the same location type. Show both location IDs, names, city, and the shared type." }, { "role": "assistant", "content": "SELECT L1.location_id AS location1_id, L1.name AS location1_name, L2.location_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 transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ...
[ { "role": "user", "content": "Count the total number of cases that are currently marked as 'Open'." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM cases WHERE status = 'Open'" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t...
[ { "role": "user", "content": "What is the average and maximum total_supply for tokens grouped by decimals? Provide columns: decimals, avg_supply, max_supply." }, { "role": "assistant", "content": "SELECT decimals,\n AVG(total_supply) AS avg_supply,\n MAX(total_supply) AS max_supply\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.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address cha...
[ { "role": "user", "content": "Find pairs of BUY and SELL trades from the trades table for the same account that occurred on the same settlement_date and had matching quantities." }, { "role": "assistant", "content": "SELECT\n a.trade_id AS buy_trade_id,\n b.trade_id AS sell_trade_id,\n a.acco...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit...
[ { "role": "user", "content": "Retrieve review comments and their overall rating for properties that currently have at least one room with a status of 'Available'. Include the review ID, property ID, and review date." }, { "role": "assistant", "content": "SELECT r.review_id, r.comment, r.rating_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 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 applications including the application reference number, the first and last name of the citizen who submitted it, and the name of the service the application is for." }, { "role": "assistant", "content": "SELECT T1.reference_number, T2.first_name, T2.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 government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "List each player's most recent achievement unlock, showing the player_id, achievement_id, and unlocked_at timestamp." }, { "role": "assistant", "content": "SELECT pa.player_id, pa.achievement_id, pa.unlocked_at FROM gaming_technology.player_achievements pa INNER JOI...
You are an SQL statement expert. Given the table 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 every booking together with the route number and description for the trip being booked." }, { "role": "assistant", "content": "SELECT b.booking_id, b.passenger_id, b.trip_id, r.route_number, r.description\nFROM transportation.bookings b\nJOIN transportation.rou...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati...
[ { "role": "user", "content": "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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "For each user, can you list the number of comments they made on posts containing the hashtag 'news'?" }, { "role": "assistant", "content": "SELECT c.user_id, COUNT(c.comment_id) AS comment_count\nFROM social_media.comments c\nJOIN social_media.post_hashtags ph ON c....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ...
[ { "role": "user", "content": "For Sui coins, can you show the coin_type and owner address for each coin where the balance is greater than 100000?" }, { "role": "assistant", "content": "SELECT coin_type, owner FROM sui_coins WHERE CAST(balance AS NUMERIC) > 100000;" }, { "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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "What is the current job satisfaction level or feedback from staff members working at a specific train station?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on job satisfaction levels or feedback from staff members as this data is...
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": "Provide the count of diagnoses by status." }, { "role": "assistant", "content": "SELECT status,\n COUNT(*) AS count\nFROM healthcare.diagnoses\nGROUP BY status;" }, { "role": "user", "content": "Now only include statuses with more than 10 diagnoses...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry ...
[ { "role": "user", "content": "List all in-game items of type 'Consumable', showing for each item the item name, cost amount, and the total number of players who have that item in their inventory." }, { "role": "assistant", "content": "SELECT i.item_name, i.cost_amount, COUNT(DISTINCT pi.player_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "Show me all employees (employee_id, first_name, last_name) in the 'Investment' department who have processed loans (loan_id) with a principal amount greater than $100,000, along with the count of such loans for each employee." }, { "role": "assistant", "content": "S...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "Which agents were hired in 2023 and have a commission rate over 0.07? Return their agent_id, full name, agency name, and hire date." }, { "role": "assistant", "content": "SELECT agent_id, first_name, last_name, agency_name, hire_date\nFROM insurance.agents\nWHERE EX...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "Show the count of vehicles for each type." }, { "role": "assistant", "content": "SELECT type, COUNT(*) AS vehicle_count FROM transportation.vehicles GROUP BY type;" }, { "role": "user", "content": "Only include types where the vehicle count is greater th...
You are an SQL statement expert. Given the table 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 first name and last name of citizens along with the amount of payments they have made." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.amount FROM government_services.citizens AS T1 JOIN government_services.payments 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "How many unique patient records are there for each gender?" }, { "role": "assistant", "content": "SELECT gender, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patients GROUP BY gender;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Find all ERC20 tokens with a total supply greater than 1 billion, including their names, symbols, and contract addresses." }, { "role": "assistant", "content": "SELECT name, symbol, contract_address FROM token_metas WHERE is_erc20 = 1 AND CAST(total_supply AS decima...
You are an SQL statement expert. Given the table 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": "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 healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb...
[ { "role": "user", "content": "Show all users along with the number of different assets they have traded as buyers." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(DISTINCT t.asset_id) AS assets_traded\nFROM trading_platform.users u\nLEFT JOIN trading_platform.trades t ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Show me all wallet addresses along with their public keys and balances, but only for wallets that have a balance greater than 1000." }, { "role": "assistant", "content": "SELECT w.address_id, a.public_key, a.balance FROM blockchain.wallets w JOIN blockchain.addresse...
You are an SQL statement expert. Given the table 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.addresses ( address_id.text, public_key.text, balance.numeric ) CREATE TABLE blockchain.wallets ( wallet_id ...
[ { "role": "user", "content": "List each item's name, type, and rarity, along with the currency in which it can be purchased and its cost." }, { "role": "assistant", "content": "SELECT item_name, item_type, rarity, cost_currency, cost_amount FROM gaming_technology.in_game_items;" }, { "ro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.in_game_items ( item_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the ite...
[ { "role": "user", "content": "How many contracts are deployed each month for each status?" }, { "role": "assistant", "content": "SELECT TO_CHAR(deployed_at, 'YYYY-MM') AS deploy_month,\n status,\n COUNT(*) AS contract_count\nFROM web3.contracts\nGROUP BY TO_CHAR(deployed_at, 'YYYY-MM...
You are an SQL statement expert. Given the table 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 me the total invoice amount and the number of invoices for each client in 2024, and include the earliest and latest invoice issue date for each client." }, { "role": "assistant", "content": "SELECT client_id, SUM(total_amount) AS total_invoice_amount, COUNT(*) ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice invo...
[ { "role": "user", "content": "I want to see, for each guest, the total number of payments they have made and the timestamp of their latest payment." }, { "role": "assistant", "content": "SELECT p.guest_id,\n COUNT(p.payment_id) AS payment_count,\n t.last_ts\nFROM hospitality_technolo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.payments ( payment_id character varying(64) NOT NULL, reservation_id character varying(64), gues...
[ { "role": "user", "content": "Show all policies that were cancelled in 2024, including their policy_number, cancellation_date, and cancellation_reason. Also show the file name of any associated claim documents." }, { "role": "assistant", "content": "SELECT p.policy_number, p.cancellation_date, p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "List the top 5 largest PDF documents in claim_documents, showing document_id, claim_id, file_name, and file_size_bytes." }, { "role": "assistant", "content": "SELECT document_id,\n claim_id,\n file_name,\n file_size_bytes\nFROM insurance.claim_docu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d...
[ { "role": "user", "content": "Provide the count of applications grouped by their status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS application_count\nFROM government_services.applications\nGROUP 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 government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "List all projects that completed fundraising rounds in the last 6 months, including their investment value and valuation." }, { "role": "assistant", "content": "SELECT project_name, investment_value, valuation FROM project_fundraising_record WHERE investment_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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and the length of their ABI in characters, sorted by ABI length in descending order." }, { "role": "assistant", "content": "SELECT address, deployer_address, LENGTH(abi) 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 web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_a...
[ { "role": "user", "content": "For each asset, calculate the total quantity and average price of orders that have status 'filled'." }, { "role": "assistant", "content": "SELECT o.asset_id,\n SUM(o.quantity) AS total_quantity,\n AVG(o.price) AS average_price\nFROM trading_platform....
You are an SQL statement expert. Given the table 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": "Which fundraising projects in 2023 have an associated token, and what are their investment amounts, chain, and token narratives?" }, { "role": "assistant", "content": "SELECT p.project_name, p.investment_value, t.chain, t.narrative\nFROM project_fundraising_record 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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "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": "List the names of agencies that were established before any appointments were recorded in the system." }, { "role": "assistant", "content": "SELECT agency_name FROM agencies WHERE established_date < (SELECT MIN(created_at) FROM appointments);" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "role": "user", "content": "Find the total number of likes made on posts versus comments. Show two columns: like_type (either 'post' or 'comment') and like_count." }, { "role": "assistant", "content": "SELECT CASE WHEN post_id IS NOT NULL THEN 'post' ELSE 'comment' END AS like_type, COUNT(*) 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 social_media.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
[ { "role": "user", "content": "Show me the list of posts with their content and the usernames of users who commented on them, for posts that are public." }, { "role": "assistant", "content": "SELECT p.post_id, p.content, u.username AS commenter_username\nFROM social_media.posts p\nJOIN social_med...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t...
[ { "role": "user", "content": "Show me all policy beneficiaries who were added in the last 6 months, along with their policy details and percentage shares." }, { "role": "assistant", "content": "SELECT pb.*, pp.policy_id, pp.customer_id, pp.payment_date FROM insurance.policy_beneficiaries pb 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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo...
[ { "role": "user", "content": "Show me all properties in California with a star rating above 4.0, along with the count of active staff members at each property." }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, p.star_rating, COUNT(s.staff_id) AS active_staff_count 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.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List transactions where the description includes another transaction's reference_number, showing both transaction IDs and the referenced reference_number." }, { "role": "assistant", "content": "SELECT t1.transaction_id AS source_id, t2.transaction_id AS referenced_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id text PRIMARY KEY, account_id text, related_account_id text, transactio...
[ { "role": "user", "content": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their token symbol and narrative." }, { "role": "assistant", "content": "SELECT token_symbol, narrative, usd_value FROM smart_money_token_inflow WHERE type = 1 ORDER 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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Show me all loans with matching collateral, displaying loan_id, principal_amount, the collateral ticker, and its sector." }, { "role": "assistant", "content": "SELECT\n l.loan_id,\n l.principal_amount,\n s.ticker_symbol,\n s.sector\nFROM financial_services.loans...
You are an SQL statement expert. Given the table 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": "Find managers who have at least one agent reporting to them whose status is 'inactive'. List the manager's full name and the full name of the inactive agent." }, { "role": "assistant", "content": "SELECT T2.first_name AS manager_first_name, T2.last_name AS manager_l...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "List all medications whose manufacturer field is not null." }, { "role": "assistant", "content": "SELECT medication_id, medication_name, generic_name, manufacturer, ndc_code, description\nFROM healthcare.medications\nWHERE manufacturer 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 text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "I want to list all insurance plans along with the number of medical records that have a record_date in 2024. Display plan_id, plan_name, and the total medical records." }, { "role": "assistant", "content": "SELECT ip.plan_id, ip.plan_name, COUNT(mr.record_id) AS tot...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "List the medication IDs and names for all entries where the description is missing or empty." }, { "role": "assistant", "content": "SELECT medication_id, medication_name FROM healthcare.medications WHERE description IS NULL OR description = '';" }, { "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 healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd...
[ { "role": "user", "content": "List the top 5 tokens by 24 hour trading volume on DEX pools." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, volume_24h \nFROM token_dexpool_info \nORDER BY volume_24h DESC LIMIT 5;" }, { "role": "user", "content": "Show only the...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE project_fundraising_record (", "id character varying(32) NOT NULL, -- fundraising record id", "project_id ch...
[ { "role": "user", "content": "Summarize the total principal amount for loans, grouped by customer and their account type. Include the customer's full name." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.account_type, SUM(T3.principal_amount) FROM financial_services...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ...
[ { "role": "user", "content": "List all securities (security_id, ticker_symbol, security_name) that belong to the 'Technology' sector and have a currency of 'USD'." }, { "role": "assistant", "content": "SELECT security_id, ticker_symbol, security_name FROM financial_services.securities WHERE sect...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "List pairs of token transfers that occurred within the same transaction and for the same token, but were sent to different recipient addresses. Show both transfer IDs and the shared transaction ID and token ID." }, { "role": "assistant", "content": "SELECT t1.transf...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ...
[ { "role": "user", "content": "List all pairs of narratives where the first narrative has a higher market_cap than the second. Display narrative1, narrative2, cap1, cap2." }, { "role": "assistant", "content": "SELECT n1.narrative AS narrative1, n2.narrative AS narrative2, n1.market_cap AS cap1, 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 narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume...
[ { "role": "user", "content": "Show all token symbols along with the contract address where the token was created." }, { "role": "assistant", "content": "SELECT token_symbol, contract_address FROM web3.tokens;" }, { "role": "user", "content": "Can you also include the deployer address...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Show me the top 5 tokens by USD value held on the Binance Smart Chain, along with their average price and total balance." }, { "role": "assistant", "content": "SELECT token_symbol, SUM(usd_value) as total_usd_value, AVG(price) as average_price, SUM(balance) as total...
You are an SQL statement expert. Given the table 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 character varying(32) NOT NULL, -- the snapshot time of record, converted from origi...
[ { "role": "user", "content": "I need a report showing each active customer's full name and email, along with the number of loans they have and the total principal amount across those loans." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS full_name,\n c.e...
You are an SQL statement expert. Given the table 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 all contracts deployed on the 'ethereum' network along with their deployer addresses and the count of token transfers associated with each contract, sorted by transfer count in descending order." }, { "role": "assistant", "content": "SELECT c.address, c.depl...
You are an SQL statement expert. Given the table 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": "Retrieve all reservations and the full name of the guest who made each reservation." }, { "role": "assistant", "content": "SELECT T1.reservation_id, T2.first_name, T2.last_name FROM hospitality_technology.reservations AS T1 INNER JOIN hospitality_technology.guests 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.text, property_name.text, address_line1.text, address_line2.text, city....
[ { "role": "user", "content": "Show the total payment amount and number of payments processed by each staff member, including their full names." }, { "role": "assistant", "content": "SELECT st.staff_id, st.first_name, st.last_name, COUNT(p.payment_id) AS payment_count, SUM(p.amount) AS total_amou...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_...
[ { "role": "user", "content": "List law firm names and the full name and specialization of all lawyers hired after 2020." }, { "role": "assistant", "content": "SELECT T1.firm_name, T2.first_name || ' ' || T2.last_name AS lawyer_full_name, T2.specialization FROM law_firms AS T1 JOIN lawyers AS T2 ...
You are an SQL statement expert. Given the table 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": "Show me all reservations made by guests from 'California' with their full name and the property name where they stayed. Include the reservation ID and check-in date." }, { "role": "assistant", "content": "SELECT t1.reservation_id, t2.first_name, t2.last_name, t3.pro...
You are an SQL statement expert. Given the table 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": "Show the count of applications submitted per day for the last 7 days. Include the date and application_count, ordered by date ascending." }, { "role": "assistant", "content": "SELECT CAST(submitted_at AS date) AS date,\n COUNT(*) AS application_count\nFROM gov...
You are an SQL statement expert. Given the table 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": "Show a list of clients whose status is 'inactive', including their first and last name, email, phone, and date registered." }, { "role": "assistant", "content": "SELECT first_name, last_name, email, phone, date_registered\nFROM legal_services.clients\nWHERE 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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List pairs of partners in the same firm, showing each partner's full name and hire_date." }, { "role": "assistant", "content": "SELECT p1.first_name || ' ' || p1.last_name AS partner1_name,\n p1.hire_date AS partner1_hire,\n p2.first_name || ' ' || p2.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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "List all 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": "For each ERC20 token, I need the total historical balance and number of unique holders from erc20_balances_historical. Include contract_address, total_balance, holder_count, symbol, and decimals." }, { "role": "assistant", "content": "SELECT bh.contract_address,\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_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "List all posts made by user 'U456'." }, { "role": "assistant", "content": "SELECT post_id, user_id, content, media_url, media_type, created_at, visibility FROM social_media.posts WHERE user_id = 'U456';" }, { "role": "user", "content": "Filter to only in...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, -- unique identifier for the post user_id characte...
[ { "role": "user", "content": "Show me all orders that resulted in a trade, listing the order ID, order type, and the corresponding trade ID." }, { "role": "assistant", "content": "SELECT t1.order_id, t1.order_type, t2.trade_id FROM trading_platform.orders AS t1 JOIN trading_platform.trades AS t2...
You are an SQL statement expert. Given the table 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": "What is the current salary of employee with ID 'EMP123'?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about an employee's salary as it is not included in the data available in the 'employees' table." } ]
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE manufacturing.employees ( ...
[ { "role": "user", "content": "Which customers have accounts in more than one state? Please show their customer_id, full name, and the list of states where they hold accounts." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name || ' ' || c.last_name AS full_name, STRING_AGG(...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "For each exchange, compute the percentage change in total USD value of its holdings between snapshots '2023-01-01 00:00:00' and '2023-02-01 00:00:00'. Show exchange, chain, value_jan, value_feb, and pct_change." }, { "role": "assistant", "content": "SELECT t1.exchan...
You are an SQL statement expert. Given the table 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 character varying(32) NOT NULL, -- the snapshot time of record, converted ...
[ { "role": "user", "content": "I need all pairs of hashtags that start with the same first two letters. Show both tag names." }, { "role": "assistant", "content": "SELECT h1.tag_name AS tag1, h2.tag_name AS tag2\nFROM social_media.hashtags h1\nJOIN social_media.hashtags h2\n ON LEFT(h1.tag_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 social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre...
[ { "role": "user", "content": "For each game, count how many achievements it has and calculate the average points." }, { "role": "assistant", "content": "SELECT game_id,\n COUNT(*) AS total_achievements,\n AVG(points) AS avg_points\nFROM achievements\nGROUP BY game_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 gaming_technology.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url t...
[ { "role": "user", "content": "Show all messages that include a media attachment, along with the sender's user ID and the conversation ID." }, { "role": "assistant", "content": "SELECT message_id, sender_user_id, conversation_id, media_url, media_type, sent_at FROM social_media.messages WHERE med...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.messages ( message_id text PRIMARY KEY, conversation_id text, sender_user_id text, content text, media_url...
[ { "role": "user", "content": "What is the minimum, maximum, and average commission rate among all agents?" }, { "role": "assistant", "content": "SELECT MIN(commission_rate) AS min_commission_rate, MAX(commission_rate) AS max_commission_rate, AVG(commission_rate) AS average_commission_rate FROM i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin...
[ { "role": "user", "content": "Show me the top 10 transactions by gas price, including the from_address, to_address, and block_number, sorted in descending order." }, { "role": "assistant", "content": "SELECT from_address, to_address, block_number, gas_price FROM web3.transactions ORDER BY gas_pr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add...
[ { "role": "user", "content": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their chain information." }, { "role": "assistant", "content": "SELECT token_symbol, chain, usd_value FROM smart_money_token_inflow WHERE type = 1 ORDER BY usd_value DES...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative character varying(512) NOT NULL, -- the id of narrative top_3_coins text, -- the top 3 token...
[ { "role": "user", "content": "How many reservations does each room_type have, including property_id and room_type_id?" }, { "role": "assistant", "content": "SELECT property_id,\n room_type_id,\n COUNT(*) AS reservation_count\nFROM hospitality_technology.reservations\nGROUP BY propert...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room...
[ { "role": "user", "content": "Show me each doctor and the total number of unique patients they have prescribed medications to. Include the doctor's full name and the patient count." }, { "role": "assistant", "content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(DISTINCT p.patient_id) ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "List the names and cities of all service locations, along with the agency ID, where the locations are marked as accessible." }, { "role": "assistant", "content": "SELECT location_name, city, agency_id FROM government_services.service_locations WHERE is_accessible = ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.service_locations ( location_id character varying(64) NOT NULL, -- unique identifier for the ph...
[ { "role": "user", "content": "Show all routes where the estimated duration is at least 120 minutes including their route number, type, and origin and destination location IDs." }, { "role": "assistant", "content": "SELECT route_number, type, origin_location_id, destination_location_id\nFROM tran...
You are an SQL statement expert. Given the table 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": "List all clients with the count of cases they have opened." }, { "role": "assistant", "content": "SELECT\n c.client_id,\n c.first_name,\n c.last_name,\n COUNT(cs.case_id) AS case_count\nFROM legal_services.clients c\nLEFT JOIN legal_services.cases cs ON c.client...
You are an SQL statement expert. Given the table 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": "Could you please provide a list of patients along with the total count of chronic diagnoses they have received? Show the patient's ID, first name, last name, and the count." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, COUNT(...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "List all pairs of clients who registered on the same day, showing each client's first_name, last_name, and the registration date." }, { "role": "assistant", "content": "SELECT c1.first_name AS first_name_1, c1.last_name AS last_name_1, c2.first_name AS first_name_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 legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad...
[ { "role": "user", "content": "Show me all guests from California who are loyalty members, along with their email and phone number, ordered by last name." }, { "role": "assistant", "content": "SELECT guest_id, first_name, last_name, email, phone_number FROM hospitality_technology.guests WHERE sta...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "Which patients have a primary insurance policy and are subscribed to a plan provided by 'Cigna'? List patient ID, full name, policy number, plan ID, and insurance provider." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.pol...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "我想查询某个特定组件ID的详细信息,包括组件名称、材料名称、材料密度以及供应商ID,同时还需要知道该组件在哪个装配线上的飞机型号ID。" }, { "role": "assistant", "content": "SELECT c.component_id, c.component_name, m.material_name, m.density_kg_m3, c.supplier_id, al.aircraft_model_id\nFROM manufacturing.components c\nJOIN manufactu...
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 manufacturing.components ( component_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "List all pairs of users where the first user registered before the second user, including both usernames and their registration dates." }, { "role": "assistant", "content": "SELECT a.username AS user1, a.created_at AS user1_created, b.username AS user2, b.created_at...
You are an SQL statement expert. Given the table 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": "Find all DApps that have been interacted with by users who have wallets with more than 1000 in their order quantities." }, { "role": "assistant", "content": "SELECT DISTINCT d.dapp_id, d.name, d.description FROM trading_platform.dapps d JOIN trading_platform.orders ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Show me all customers (customer_id, first_name, last_name) from California (state = 'CA') who have both a checking account (account_type = 'Checking') and a home loan (loan_type = 'Home'), along with their total account balance and loan principal amount." }, { "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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...