conversations listlengths 2 8 | system stringlengths 284 8.23k |
|---|---|
[
{
"role": "user",
"content": "List pairs of citizens who share the same email domain."
},
{
"role": "assistant",
"content": "SELECT c1.first_name AS first1,\n c1.last_name AS last1,\n c2.first_name AS first2,\n c2.last_name AS last2,\n SPLIT_PART(c1.contact_email, '@', 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List all securities (security_id, ticker_symbol, security_name) that have a currency of 'EUR' and were last updated within the last 30 days, along with their exchange and sector information."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, 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.securities (
security_id character varying(64) NOT NULL, -- unique identifier for the security
... |
[
{
"role": "user",
"content": "What is the current market price of a Boeing 737 MAX aircraft?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to the current market price of aircraft models. The data I have is limited to technical specifications and general information ab... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count."
},
{
"role": "assistant",
"content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHE... | You are an SQL statement expert. Given the table 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": "Show all medical records with the record_id, record_date, the patient's insurance policy_number, and the doctor's ID, for records linked to a currently active insurance policy."
},
{
"role": "assistant",
"content": "SELECT mr.record_id, mr.record_date, pi.policy_num... | You are an SQL statement expert. Given the table 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": "Provide a count of citizens registered per calendar year."
},
{
"role": "assistant",
"content": "SELECT CAST(EXTRACT(YEAR FROM registration_date) AS INTEGER) AS registration_year, COUNT(*) AS citizen_count FROM government_services.citizens GROUP BY 1 ORDER BY 1;"
... | You are an SQL statement expert. Given the table 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 all ERC20 tokens where the price is greater than $10, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.contract_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "List the full name and bar number of all lawyers who were hired before 2015."
},
{
"role": "assistant",
"content": "SELECT first_name || ' ' || last_name AS lawyer_full_name, bar_number\nFROM legal_services.lawyers\nWHERE hire_date < '2015-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "What is the average ROI and average realized_ratio for each chain?"
},
{
"role": "assistant",
"content": "SELECT chain,\n AVG(roi) AS avg_roi,\n AVG(realized_ratio) AS avg_realized_ratio\nFROM smart_money_token_performance\nGROUP BY chain;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,... |
[
{
"role": "user",
"content": "List the first and last name of each citizen along with the city and state of the service location for their agency."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_serv... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Provide a report of each user with their username and the count of all log entries from the last 30 days."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(l.log_id) AS log_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.log... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "List properties and the average base rate of their room types."
},
{
"role": "assistant",
"content": "SELECT T1.property_name , AVG(T2.base_rate) FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room_types AS T2 ON T1.property_id = T2.prop... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens where the price is greater than $0.10."
},
{
"role": "assistant",
"content": "SELECT tm.name, tm.contract_address, tm.total_supply FR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"role": "user",
"content": "What is the average speed of train number T9876 during its last journey?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the average speed of train number T9876 during its last journey. The data in the trains table does not inclu... | 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.t... |
[
{
"role": "user",
"content": "Show me all distinct dosage forms used in prescriptions."
},
{
"role": "assistant",
"content": "SELECT DISTINCT dosage FROM healthcare.prescriptions;"
}
] | You are an SQL statement expert. Given the table 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.prescriptions ( prescription_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio... |
[
{
"role": "user",
"content": "I need to find all tickets for a specific route 'RT456' along with the car details and route information."
},
{
"role": "assistant",
"content": "SELECT t.ticket_id, t.seat_number, t.price, tc.car_number, tc.car_type, r.route_name, r.description\nFROM train_station_m... | 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 train_station_management.train_cars (
car_id character varying(64) NOT NULL, -- ... |
[
{
"role": "user",
"content": "For each player, calculate the total quantity of items they have acquired. Return player_id and total_quantity."
},
{
"role": "assistant",
"content": "SELECT player_id,\n SUM(quantity) AS total_quantity\nFROM gaming_technology.player_inventory\nGROUP BY player... | You are an SQL statement expert. Given the table 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_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquire... |
[
{
"role": "user",
"content": "What is the average commission_rate for each agent status and only show statuses with an average commission_rate above 0.05?"
},
{
"role": "assistant",
"content": "SELECT status,\n AVG(commission_rate) AS avg_commission_rate\nFROM insurance.agents\nGROUP BY st... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "Show me the top 5 users who have interacted with DApps, along with the count of distinct DApps they interacted with and their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT w.user_id, COUNT(DISTINCT d.dapp_id) AS dapp_count, w.address FROM trading_p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "List document names and versions for documents that share the same case_id, showing each pair of versions."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "For all chains, which token held by centralized exchanges (CEX) has the highest ROI according to smart money token performance? Show token symbol, chain, exchange, total USD value held on CEX, and the smart money ROI."
},
{
"role": "assistant",
"content": "SELECT 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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Show me all asset types along with the count of distinct assets and the count of log actions for each type."
},
{
"role": "assistant",
"content": "SELECT a.type, COUNT(DISTINCT a.asset_id) AS asset_count, COUNT(l.log_id) AS action_count FROM trading_platform.assets ... | You are an SQL statement expert. Given the table 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.assets ( asset_id text, name text, symbol text, type text )
CREATE TABLE trading_platform.logs ( log_i... |
[
{
"role": "user",
"content": "Which chain has the highest total USD inflow from buy transactions (type=1), and how many distinct tokens were involved in that inflow?"
},
{
"role": "assistant",
"content": "SELECT chain, SUM(usd_value) AS total_inflow, COUNT(DISTINCT token_symbol) AS distinct_toke... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_inflow ( token_address text, token_symbol text, token_amount numeric, usd_value numeric, avg_price nu... |
[
{
"role": "user",
"content": "Get a list of room types along with their property name and the count of rooms currently Available for each type."
},
{
"role": "assistant",
"content": "SELECT rt.type_name, p.property_name, COUNT(r.room_id) AS available_rooms_count\nFROM hospitality_technology.room... | You are an SQL statement expert. Given the table 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": "Retrieve the policy_number, start_date, end_date, premium_amount, and corresponding product_name for policies with a coverage_limit greater than 500000."
},
{
"role": "assistant",
"content": "SELECT p.policy_number, p.start_date, p.end_date, p.premium_amount, ip.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 insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "List all room types that have at least one service in the 'Spa' category, including the room type name, property name, and service name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT rt.type_name, p.property_name, s.service_name\nFROM hospitality_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 hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "For each Avalanche token tick, calculate the total transfer volume and transaction count over the past 7 days using token_activities_avalanche. Include the token tick, total_volume, and tx_count."
},
{
"role": "assistant",
"content": "SELECT\n tick,\n SUM(amt) AS ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List all reservations where the number of adults is greater than 2, showing reservation_id, guest_id, and the total_amount."
},
{
"role": "assistant",
"content": "SELECT reservation_id, guest_id, total_amount\nFROM hospitality_technology.reservations\nWHERE num_adul... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, property_id character varying(64) ... |
[
{
"role": "user",
"content": "For each customer, provide a summary of their account statuses, showing their full name, account status, and the count of accounts for each status."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, a.status, COUNT(a.account_id) AS account_coun... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "Show the number of employees in each department."
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) AS employee_count\nFROM financial_services.employees\ngroup BY department;"
},
{
"role": "user",
"content": "Exclude departments that have... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "I want to see pairs of items from the same game that share the same rarity but are of different types. Show each pair's names and types."
},
{
"role": "assistant",
"content": "SELECT a.game_id,\n a.item_name AS item1_name,\n a.item_type AS item1_type,\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 gaming_technology.in_game_items ( item_id.uuid, game_id.uuid, item_name.text, item_type.text, description.text, rarity.... |
[
{
"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": "List all medical records, showing the record ID, record date, and the full name of the doctor who created the record. Include the patient ID as well."
},
{
"role": "assistant",
"content": "SELECT mr.record_id, mr.record_date, mr.patient_id, d.first_name, d.last_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "List the ERC20 tokens (from token_metas) with exactly 6 decimals. Show their symbol, contract_address, and name."
},
{
"role": "assistant",
"content": "SELECT symbol, contract_address, name FROM token_metas WHERE is_erc20 = 1 AND decimals = 6;"
},
{
"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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "For each chain, which centralized exchange holds the largest total USD value in their token balance as of the most recent snapshot?"
},
{
"role": "assistant",
"content": "WITH latest_snapshot AS (\n SELECT MAX(snapshot_time) AS max_time FROM cex_token_balance\n)\nS... | You are an SQL statement expert. Given the table 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": "How many diagnoses does each status have grouped by is_chronic flag?"
},
{
"role": "assistant",
"content": "SELECT is_chronic, status, COUNT(*) AS count FROM healthcare.diagnoses GROUP BY is_chronic, 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 healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty... |
[
{
"role": "user",
"content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?"
},
{
"role": "assistant",
"content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.develo... | You are an SQL statement expert. Given the table 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.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "List all events and any token transfers that occurred in the same transaction, showing event_id, event_name, transfer_id, and token_symbol."
},
{
"role": "assistant",
"content": "SELECT\n e.event_id,\n e.event_name,\n tt.transfer_id,\n tk.token_symbol\nFROM web3... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Show me a list of all properties along with their average overall review rating."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.properties p\nJOIN hospitality_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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "I need to list the top 5 ERC20 tokens by total supply, including symbol, contract_address, and name."
},
{
"role": "assistant",
"content": "SELECT tm.contract_address, tm.symbol, tm.name, CAST(tm.total_supply AS DECIMAL) AS total_supply\nFROM token_metas tm\nWHERE t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List all NFT collections where the floor price is greater than 0.5 ETH, including their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address FROM nft_collections WHERE CAST(floor_price AS decimal) > 0.5 AND floor_price_s... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"role": "user",
"content": "For each contract, can you list the token symbols and total supply of all tokens created by that contract, along with the contract's current status?"
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address AS contract_address, c.status, t.token_symbol,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "I want to identify pairs of bookings that share the same payment_transaction_id, showing both booking IDs and the payment_transaction_id."
},
{
"role": "assistant",
"content": "SELECT b1.booking_id AS booking1, b2.booking_id AS booking2, b1.payment_transaction_id\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.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, s... |
[
{
"role": "user",
"content": "For each user with 'approved' KYC status, show their user ID and the total amount in their unspent UTXOs."
},
{
"role": "assistant",
"content": "SELECT T1.user_id, SUM(T2.amount) FROM trading_platform.kyc_audit AS T1 JOIN trading_platform.utxos AS T2 ON T1.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 trading_platform.utxos ( utxo_id text, transaction_id text, output_index integer, address text, amount numeric, spent b... |
[
{
"role": "user",
"content": "What are the fuel consumption rates per hour for the Boeing 747-8 model?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "List all appointments along with the patient's full name and the doctor's full name."
},
{
"role": "assistant",
"content": "SELECT\n a.appointment_id,\n a.appointment_time,\n p.first_name AS patient_first_name,\n p.last_name AS patient_last_name,\n d.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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List all depot locations in the United States with their city and state information."
},
{
"role": "assistant",
"content": "SELECT name, city, state_province FROM transportation.locations WHERE type = 'depot' AND country = 'United States';"
},
{
"role": "use... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro... |
[
{
"role": "user",
"content": "What is the performance review score for employee with ID 'EMP456' for the last quarter?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't assist with information about performance review scores as this data is not included 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": "How many medications does each manufacturer have?"
},
{
"role": "assistant",
"content": "SELECT manufacturer, COUNT(*) AS med_count\nFROM healthcare.medications\nGROUP BY manufacturer;"
},
{
"role": "user",
"content": "Only include manufacturers with mor... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "I need to find pairs of players who share the same email domain. For each pair, return player1_id, player2_id, and the shared domain."
},
{
"role": "assistant",
"content": "SELECT p1.player_id AS player1_id,\n p2.player_id AS player2_id,\n LOWER(SPLIT_PA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "List the names of services and the total number of times each service has been ordered. Only include services that have been ordered at least once."
},
{
"role": "assistant",
"content": "SELECT T1.service_name, count(T2.order_id) AS order_count FROM hospitality_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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Which players have unlocked any achievement?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT player_id FROM player_achievements;"
},
{
"role": "user",
"content": "Show me the player ID and the total number of points they've accumulated from all un... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points.... |
[
{
"role": "user",
"content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and the count of events emitted by each contract, sorted by event count in descending order."
},
{
"role": "assistant",
"content": "SELECT c.address, c.deployer_address, COU... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "For each diagnosis, show the diagnosis code, description, and the full name of the doctor who made the diagnosis."
},
{
"role": "assistant",
"content": "SELECT dgn.diagnosis_code, dgn.description, doc.first_name AS doctor_first_name, doc.last_name AS doctor_last_nam... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Find all smart contracts where the code length is greater than 1000 characters."
},
{
"role": "assistant",
"content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE LENGTH(code) > 1000;"
},
{
"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 blockchain.smart_contracts ( contract_id text PRIMARY KEY, creator_address text, code text, timestamp timestamp )
|
[
{
"role": "user",
"content": "List the usernames and user IDs of all users whose bio contains the word 'developer'."
},
{
"role": "assistant",
"content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Find all medical records where the treatment plan includes 'physical therapy' and the patient has an active primary insurance plan, showing the patient ID, record date, and insurance provider details."
},
{
"role": "assistant",
"content": "SELECT mr.patient_id, mr.r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List all patients who do not have an email address on file, showing their patient_id, first_name, last_name, and phone_number."
},
{
"role": "assistant",
"content": "SELECT patient_id,\n first_name,\n last_name,\n phone_number\nFROM healthcare.pati... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "Show me the average market cap and average 24-hour price change percentage for tokens on each chain."
},
{
"role": "assistant",
"content": "SELECT chain, AVG(market_cap) AS average_market_cap, AVG(price_change_percentage_24h) AS average_price_change_24h FROM token_b... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character var... |
[
{
"role": "user",
"content": "Provide every combination of medication name and insurance plan name."
},
{
"role": "assistant",
"content": "SELECT m.medication_name, p.plan_name\nFROM healthcare.medications AS m\nCROSS JOIN healthcare.insurance_plans AS 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 healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i... |
[
{
"role": "user",
"content": "List the top 3 tokens by net flow on the Binance chain, including their symbol and average cost."
},
{
"role": "assistant",
"content": "SELECT token_symbol, net_flow, avg_cost FROM smart_money_token_performance WHERE chain = 'Binance' ORDER BY net_flow DESC LIMIT 3;... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, -- the token's address token_symbol char... |
[
{
"role": "user",
"content": "List all insurance products that have 'auto' in their product type and are currently active, showing their product name and base premium."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, product_type, base_premium FROM insurance.insurance_prod... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "How many unique wallets hold each NFT (by contract_address and token_id) currently?"
},
{
"role": "assistant",
"content": "SELECT contract_address, token_id, COUNT(DISTINCT wallet_address) AS holder_count\nFROM nft_holders\nGROUP BY contract_address, token_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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"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": "Show me the token names and their contract addresses where the total supply is greater than 1 million, sorted by total supply in descending order."
},
{
"role": "assistant",
"content": "SELECT token_name, contract_address FROM web3.tokens WHERE total_supply > 100000... | You are an SQL statement expert. Given the table 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 text, contract_address text, token_name text, token_symbol text, decimals integer, total_supply ... |
[
{
"role": "user",
"content": "List all patients who have active primary insurance plans with expiration dates within the next 60 days, including their policy numbers and subscriber names."
},
{
"role": "assistant",
"content": "SELECT pi.patient_id, pi.policy_number, pi.subscriber_name FROM healt... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "How many documents are there for each document_type? Show document_type and count ordered by the count in descending order."
},
{
"role": "assistant",
"content": "SELECT document_type,\n COUNT(*) AS count\nFROM legal_services.documents\nGROUP BY document_type\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "Can you show me each user's address and the date their wallet was created?"
},
{
"role": "assistant",
"content": "SELECT user_id, address, created_at FROM trading_platform.wallets;"
},
{
"role": "user",
"content": "Now, can you show only wallets created ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "List all managers (employees who have other employees reporting to them) along with the count of their direct reports, showing only those with more than 5 reports."
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name, e.last_name, COUNT(r.employ... | You are an SQL statement expert. Given the table 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.employees ( employee_id text PRIMARY KEY, first_name text, last_name text, job_title text, departmen... |
[
{
"role": "user",
"content": "Find all primary insurance plans that became effective in the last 30 days, showing the patient IDs, policy numbers, and subscriber names, ordered by effective date."
},
{
"role": "assistant",
"content": "SELECT patient_id, policy_number, subscriber_name, effective_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "List all pairs of contracts deployed on the same day by the same deployer. Show deployer_address, deployment date, and both contract IDs."
},
{
"role": "assistant",
"content": "SELECT\n c1.deployer_address,\n DATE(c1.deployed_at) AS deployment_date,\n c1.contract... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "For all NFT collections on the Ethereum blockchain, show me the collection name and the current floor price. Sort by floor price descending."
},
{
"role": "assistant",
"content": "SELECT name, floor_price FROM nft_collections WHERE blockchain = 'Ethereum' ORDER BY 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "List all auto loans (loan_id, principal_amount, interest_rate) where the current principal balance is less than 40% of the original principal amount, along with the account_id and the difference between principal_amount and current_principal_balance."
},
{
"role": "assi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens with decimals equal to 18."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, total_supply FROM token_metas WHERE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "What is the current address of the employee with ID 'EMP234'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide the current address of an employee as this information is not stored in the database 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": "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 ch... |
[
{
"role": "user",
"content": "List all ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, symbol, address FROM token_prices_latest WHERE price BETWEEN 1 AND 10 AND blockchain = 'ethereum'... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "Which citizens have made payments but have not uploaded any documents? Please show their first and last names and contact emails."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name, c.last_name, c.contact_email\nFROM government_services.citizens c\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": "Show the count of applications assigned to employees, grouped by the job title of the assigned employee."
},
{
"role": "assistant",
"content": "SELECT e.job_title, COUNT(a.application_id) AS application_count FROM government_services.applications AS a JOIN governmen... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "特定の職種の従業員情報を取得したいです。従業員ID、名前、職種、雇用日を表示してください。"
},
{
"role": "assistant",
"content": "db.employees.find(\n { job_title: '<specific_job_title>' },\n { employee_id: 1, first_name: 1, last_name: 1, job_title: 1, hire_date: 1, _id: 0 }\n).sort({ hire_date: -1 })"
... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Collection 'assembly_steps'. Document structure: { _id: <ObjectId (or step_id)>, step_id: String,... |
[
{
"role": "user",
"content": "Show me all wallet addresses that belong to user_id 'U1001', along with their private keys."
},
{
"role": "assistant",
"content": "SELECT address_id, private_key FROM blockchain.wallets WHERE user_id = 'U1001';"
},
{
"role": "user",
"content": "Now 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 blockchain.wallets ( wallet_id text, user_id text, address_id text, private_key text )
|
[
{
"role": "user",
"content": "What is the average trade price for each asset for trades executed between '2024-05-01' and '2024-05-31'?"
},
{
"role": "assistant",
"content": "SELECT\n asset_id,\n AVG(price) AS avg_price\nFROM trading_platform.trades\nWHERE traded_at >= '2024-05-01' AND traded_... | You are an SQL statement expert. Given the table 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.trades (
trade_id character varying(64) NOT NULL, -- unique identifier for the trade
order_id... |
[
{
"role": "user",
"content": "For each game, show the game_id, title, the number of servers currently online, and the total current_players on those servers."
},
{
"role": "assistant",
"content": "SELECT g.game_id, g.title, COUNT(s.server_id) AS online_servers, SUM(s.current_players) AS total_on... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "Give me the total number of reservations and the sum of total_amount by month for the year 2023."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', check_in_date) AS month,\n COUNT(*) AS reservation_count,\n SUM(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 hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r... |
[
{
"role": "user",
"content": "For each guest, calculate their total spending on delivered service orders and the total number of those orders."
},
{
"role": "assistant",
"content": "SELECT g.guest_id,\n g.first_name || ' ' || g.last_name AS full_name,\n SUM(so.total_price) AS total_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 hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "Show me the top 3 narratives by trend rank, along with their top 3 tokens and 7-day price change percentage."
},
{
"role": "assistant",
"content": "SELECT ni.narrative, ni.top_3_coins, ni.price_change_percentage_7d FROM narrative_info ni ORDER BY ni.trend_rank ASC 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 project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "Show all room types that offer 'WiFi' in their amenities."
},
{
"role": "assistant",
"content": "SELECT room_type_id, property_id, type_name, amenities FROM hospitality_technology.room_types WHERE amenities LIKE '%WiFi%';"
},
{
"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 hospitality_technology.room_types ( room_type_id.text, property_id.text, type_name.text, description.text, base_rate.nu... |
[
{
"role": "user",
"content": "List all wallets holding the NFT with contract_address '0xabc123' and token_id '100' and the amount held."
},
{
"role": "assistant",
"content": "SELECT wallet_address, amount\nFROM nft_holders\nWHERE contract_address = '0xabc123'\n AND token_id = '100';"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ... |
[
{
"role": "user",
"content": "Show me all transactions (transaction_id, amount, transaction_type) where the transaction_type is 'Transfer' and the status is 'Completed', along with the account_id and related_account_id."
},
{
"role": "assistant",
"content": "SELECT transaction_id, amount, transa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the trans... |
[
{
"role": "user",
"content": "What is the average number of appointments assigned per employee for each job title?"
},
{
"role": "assistant",
"content": "SELECT e.job_title, CAST(COUNT(a.appointment_id) AS REAL) / COUNT(DISTINCT e.employee_id) AS average_appointments_per_employee FROM government... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego... |
[
{
"role": "user",
"content": "Count the number of policies issued in each calendar year, and show the year and the count."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM issued_at), COUNT(*) FROM insurance.policies WHERE issued_at IS NOT NULL GROUP BY 1 ORDER BY 1;"
}
] | You are an SQL statement expert. Given the table 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 all properties in California with a star rating above 4.0, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p JOIN hosp... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Find employees who are managers and list the number of employees they directly manage. Show the manager's full name and the count of their direct reports."
},
{
"role": "assistant",
"content": "SELECT m.first_name || ' ' || m.last_name AS manager_full_name, COUNT(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 character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "Find all wallets created by users in the last 7 days along with any tokens that have a total supply greater than 10 million, showing the wallet address and token details."
},
{
"role": "assistant",
"content": "SELECT w.address AS wallet_address, t.token_name, t.toke... | You are an SQL statement expert. Given the table 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, contract_address character varying(128) NOT NULL, token_name cha... |
[
{
"role": "user",
"content": "I need to find all components associated with a specific supplier. Can you help with that?"
},
{
"role": "assistant",
"content": "HGETALL component:<component_id>\nIF HGET component:<component_id> supplier_id = 'sup:ACME_AERO' THEN INCLUDE"
},
{
"role": "use... | 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
Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe... |
[
{
"role": "user",
"content": "Calculate the total PNL and total Net Flow for all tokens recorded on the 'Arbitrum' chain."
},
{
"role": "assistant",
"content": "SELECT SUM(pnl) as total_pnl, SUM(net_flow) as total_net_flow FROM smart_money_token_performance WHERE chain = 'Arbitrum';"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "How many likes were given to comments in June 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS comment_likes_count\nFROM social_media.likes\nWHERE comment_id IS NOT NULL \n AND DATE_TRUNC('month', created_at) = '2024-06-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, user_id char... |
[
{
"role": "user",
"content": "For each premium payment, list all previous payments made by the same customer. Show customer_id, previous_payment_id, previous_payment_date, current_payment_id, current_payment_date, and amount difference."
},
{
"role": "assistant",
"content": "SELECT p1.customer_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.premium_payments ( payment_id text, policy_id text, customer_id text, payment_date timestamp, amount_paid num... |
[
{
"role": "user",
"content": "What are the top 5 tokens by 7-day price change percentage? Show token_symbol, token_name, narrative, and chain, ordered by price_change_percentage_7d descending."
},
{
"role": "assistant",
"content": "```sql\nSELECT\n token_symbol,\n token_name,\n narrative,\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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Find the full names and emails of citizens who have received notifications with the status 'Sent' related to a document. Also show the document_id for each notification."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name, 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.