conversations listlengths 2 8 | system stringlengths 288 8.03k |
|---|---|
[
{
"role": "user",
"content": "List all narratives with a trend rank better than 50, showing the narrative name and their listed 'Top 3 Coins'."
},
{
"role": "assistant",
"content": "SELECT narrative, top_3_coins FROM narrative_info WHERE trend_rank < 50"
},
{
"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 narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"role": "user",
"content": "Find all medical records where the vitals JSON field contains a blood pressure reading with systolic higher than 140, and show the patient_id, record_date, and vitals."
},
{
"role": "assistant",
"content": "SELECT patient_id, record_date, vitals FROM healthcare.medi... | You are an SQL statement expert. Given the table 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": "What are the specific tools or equipment used during the maintenance with record_id 'REC456'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about the specific tools or equipment used during a maintenance record. The data in the ma... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"role": "user",
"content": "Show me the top 5 narratives by market cap, along with their 24-hour trading volume and 7-day price change percentage."
},
{
"role": "assistant",
"content": "SELECT narrative.text, volume_24h.numeric, price_change_percentage_7d.numeric FROM narrative_info ORDER BY m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"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": "Retrieve each prescription's id, patient's full name, medication_name, and prescription_date for prescriptions where dosage contains 'tablet'."
},
{
"role": "assistant",
"content": "SELECT pr.prescription_id, CONCAT(p.first_name, ' ', p.last_name) AS patient_name, m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, 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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "What is the current market price of a Boeing 737 MAX aircraft?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to the current market price of aircraft models. The data I have is limited to technical specifications and general information ab... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "List all pairs of tokens (show token_id for both) that share the same contract address, excluding pairs where the token_id is the same."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id1, t2.token_id AS token_id2, t1.contract_address FROM web3.to... | You are an SQL statement expert. Given the table 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": "List all invoices that were paid within 7 days of their issue date. Show invoice number, issue date, payment date, and total amount."
},
{
"role": "assistant",
"content": "SELECT invoice_number, issue_date, payment_date, total_amount FROM legal_services.invoices 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.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "Retrieve the most recent log entry for each user, including action and logged_at."
},
{
"role": "assistant",
"content": "SELECT l1.user_id,\n l1.action,\n l1.logged_at\nFROM trading_platform.logs l1\nWHERE l1.logged_at = (\n SELECT MAX(l2.logged_at)\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 trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Which cities are listed as primary_address for citizens who have a verified account? Can you show the city names and the number of verified citizens in each city?"
},
{
"role": "assistant",
"content": "SELECT SPLIT_PART(primary_address, ',', 1) AS city, COUNT(*) AS ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "What is the total USD value held by all centralized exchanges (CEX) for the token with the symbol 'BTC'?"
},
{
"role": "assistant",
"content": "SELECT SUM(usd_value) AS total_btc_cex_value FROM cex_token_balance WHERE token_symbol = 'BTC';"
},
{
"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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "List all transactions where the recipient address is not specified (i.e., to_address is NULL), showing transaction_id, from_address, value, and block_number."
},
{
"role": "assistant",
"content": "SELECT transaction_id, from_address, value, block_number\nFROM web3.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 web3.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"role": "user",
"content": "For each route, list the route_number, origin city, destination city, and the total fare collected from completed bookings."
},
{
"role": "assistant",
"content": "SELECT\n r.route_number,\n lo.city AS origin_city,\n ld.city AS destination_city,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "What is the ticket price for a journey on train number T4321?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to information about ticket prices for specific trains. The data I have is limited to train details such as model, manufacturer, c... | 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": "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": "Show me wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address, from the nft_holders table."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE 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 token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"role": "user",
"content": "Show me the names of law firms and their associated open case numbers."
},
{
"role": "assistant",
"content": "SELECT l.firm_name, c.case_number\nFROM legal_services.law_firms l\nJOIN legal_services.cases c\n ON l.managing_partner_id = c.lead_lawyer_id\nWHERE c.stat... | You are an SQL statement expert. Given the table 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.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... |
[
{
"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": "What is the maintenance schedule for the platforms at the station with ID 'ST234' for the next month?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to the maintenance schedule for the platforms at any station. The data I have only include... | 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": "Retrieve the names of all properties that have listed room types, along with the name of each room type available at that property."
},
{
"role": "assistant",
"content": "SELECT t1.property_name, t2.type_name FROM hospitality_technology.properties AS t1 INNER JOIN h... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "For each event, display its event_id, the event_id of the previous event in the same transaction (if any), and the log_index of both events."
},
{
"role": "assistant",
"content": "SELECT curr.event_id AS current_event_id,\n prev.event_id AS previous_event_... | You are an SQL statement expert. Given the table 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.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"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": "Show me the number of players registered in each country, along with the number of different games available for each country."
},
{
"role": "assistant",
"content": "SELECT p.country_code, COUNT(DISTINCT p.player_id) AS player_count, COUNT(DISTINCT g.game_id) AS gam... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Find narrative pairs where the sum of their price_change_percentage_1h is greater than 5. Show narrative1, change1, narrative2, change2, and the sum as total_change."
},
{
"role": "assistant",
"content": "SELECT n1.narrative AS narrative1, n1.price_change_percentage... | You are an SQL statement expert. Given the table 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": "List all transactions along with the user ID and username of the sender, if available. Show transaction id, from_address, user id, and username."
},
{
"role": "assistant",
"content": "SELECT tx.transaction_id, tx.from_address, w.user_id, u.username\nFROM web3.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 web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "List all service orders for spa services with their guest names and total prices, ordered by total price in descending order."
},
{
"role": "assistant",
"content": "SELECT g.first_name, g.last_name, so.order_id, so.total_price FROM hospitality_technology.service_ord... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ... |
[
{
"role": "user",
"content": "Show the email address and the creation date for every user, ordered by their username alphabetically."
},
{
"role": "assistant",
"content": "SELECT email, created_at FROM trading_platform.users ORDER BY username ASC;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "For each user, show their username and how many unique conversations they have sent at least one message in where the conversation is a group chat."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(DISTINCT m.conversation_id) AS group_chats_messaged_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.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Show the total value and total gas used for all transactions occurring in each distinct year."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM timestamp) AS transaction_year, SUM(value) AS total_value, SUM(gas_used) AS total_gas_used FROM web3.transac... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.numeric, gas_used.integer, gas_price... |
[
{
"role": "user",
"content": "Find all wallets that were created on the same day and list their wallet IDs, addresses, and the creation date."
},
{
"role": "assistant",
"content": "SELECT w1.wallet_id, w1.address, w1.created_at::date AS creation_date FROM web3.wallets w1 JOIN (SELECT 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 web3.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_id character... |
[
{
"role": "user",
"content": "List each unique plan_id and the total number of patients enrolled in that plan."
},
{
"role": "assistant",
"content": "SELECT plan_id, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patient_insurance GROUP BY plan_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.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_numb... |
[
{
"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": "List all rooms, showing their room number, type name, and the name of the property they are in."
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T2.type_name, T3.property_name FROM hospitality_technology.rooms AS T1 JOIN hospitality_technology.room_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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "Show me the top 3 peers by the number of active days (days they were last seen) in the last month, along with their IP addresses."
},
{
"role": "assistant",
"content": "SELECT peer_id, ip_address, COUNT(DISTINCT DATE(last_seen)) AS active_days FROM 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.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "Provide a count of how many peers were last seen on each distinct day recorded in the system."
},
{
"role": "assistant",
"content": "SELECT DATE(last_seen), COUNT(*) FROM trading_platform.peers GROUP BY DATE(last_seen) ORDER BY DATE(last_seen);"
}
] | You are an SQL statement expert. Given the table 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": "For each game_id, calculate the average points of achievements that have been unlocked at least once."
},
{
"role": "assistant",
"content": "SELECT a.game_id, AVG(a.points) AS average_unlocked_points FROM gaming_technology.achievements a JOIN gaming_technology.playe... | You are an SQL statement expert. Given the table 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": "What is the fuel efficiency of the train car with car_id 'TC456'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to information about the fuel efficiency of specific train cars. The data available in the train_cars table only includes deta... | 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": "For each security exchange, what is the average daily high price and the total volume recorded in market data for securities listed on that exchange over the past 6 months? Include the exchange name."
},
{
"role": "assistant",
"content": "SELECT T2.exchange, AVG(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 financial_services.market_data (
data_point_id bigserial NOT NULL, -- auto-incrementing primary key
security_id... |
[
{
"role": "user",
"content": "Show me all time entries, including the case name they are associated with."
},
{
"role": "assistant",
"content": "SELECT T1.*, T2.case_name FROM time_entries AS T1 JOIN cases AS T2 ON T1.case_id = T2.case_id"
},
{
"role": "user",
"content": "Only show m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE 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": "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": "List all ERC20 tokens from the sui_coins_metadata table where the decimals are 18, including their names and symbols."
},
{
"role": "assistant",
"content": "SELECT name, symbol FROM sui_coins_metadata WHERE decimals = 18;"
},
{
"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 erc20_balances_historical ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk i... |
[
{
"role": "user",
"content": "For each guest, list reservation_id, guest_id, check_in_date, and the next reservation_id and its check_in_date."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id,\n r1.guest_id,\n r1.check_in_date,\n r2.reservation_id AS next_reserva... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ... |
[
{
"role": "user",
"content": "Show me all home loans (loan_id, principal_amount, interest_rate) where the current principal balance is more than 75% of the original principal amount, along with the account_id and employee details (first_name, last_name) of the employee who processed the loan application."
... | You are an SQL statement expert. Given the table 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, account_id.text, related_account_id.text, transaction_type.text,... |
[
{
"role": "user",
"content": "List all room types with their type name, base rate, and the name of the property they belong to."
},
{
"role": "assistant",
"content": "SELECT rt.room_type_id, rt.type_name, rt.base_rate, p.property_name\nFROM hospitality_technology.room_types rt\nJOIN hospitality_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "List all vehicles and their last maintenance service date along with the odometer reading, including only those that have not had a fuel refill in the past 30 days."
},
{
"role": "assistant",
"content": "SELECT m.vehicle_id,\n m.last_service_date,\n m.la... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, route_number character varying(32) NOT NULL UNIQUE, de... |
[
{
"role": "user",
"content": "List all 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 all insurance plans that cover more than 10 patients as their primary insurance, along with the provider name and contact information."
},
{
"role": "assistant",
"content": "SELECT ip.plan_name, ip.insurance_provider, ip.contact_phone, ip.website, COUNT(pi.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.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Calculate the monthly total quantity of fuel consumed and the average cost_per_unit for each fuel_type in 2023."
},
{
"role": "assistant",
"content": "SELECT date_trunc('month', log_timestamp) AS month,\n fuel_type,\n SUM(quantity) AS total_quantity... | You are an SQL statement expert. Given the table 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.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu... |
[
{
"role": "user",
"content": "Show me all room types with a base rate over $200 and max occupancy of at least 4, along with their property IDs and amenities."
},
{
"role": "assistant",
"content": "SELECT room_type_id, property_id, type_name, base_rate, max_occupancy, amenities FROM hospitality_t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ... |
[
{
"role": "user",
"content": "Show projects that raised funds in 2023 along with their token symbols and current prices from token_basic_info."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name,\n pfr.rounds_name,\n pfr.investment_value,\n tbi.token_symbol,\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 text, project_id text, project_name text, rounds_name text, investment_value numeric, i... |
[
{
"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": "Show the total number of policies in each status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) FROM insurance.policies GROUP BY status"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "Count the total number of chronic diagnoses for each code_type."
},
{
"role": "assistant",
"content": "SELECT\n code_type,\n COUNT(*) AS chronic_diagnosis_count\nFROM healthcare.diagnoses\nWHERE is_chronic = TRUE\nGROUP BY code_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 healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"role": "user",
"content": "List all pairs of wallets that were created within 10 minutes of each other, showing both wallet IDs, the user_id, and both creation timestamps."
},
{
"role": "assistant",
"content": "SELECT\n w1.wallet_id AS wallet1_id,\n w2.wallet_id AS wallet2_id,\n w1.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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Show me the top 5 smart money addresses by profit on the Ethereum chain, along with their most profitable token and ROI, but only include addresses with a realized profit ratio above 70%."
},
{
"role": "assistant",
"content": "SELECT address, most_profit_token, roi ... | You are an SQL statement expert. Given the table 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": "Find the contract address and name for all NFT collections listed on the 'Ethereum' blockchain."
},
{
"role": "assistant",
"content": "SELECT contract_address, name FROM nft_collections WHERE blockchain = 'Ethereum'"
},
{
"role": "user",
"content": "For ... | You are an SQL statement expert. Given the table 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": "Show me all rooms that were last cleaned more than 3 days ago, along with their room numbers and cleaning status."
},
{
"role": "assistant",
"content": "SELECT room_number, current_condition FROM hospitality_technology.rooms WHERE last_cleaned_at < CURRENT_DATE - 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 hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "What is the detailed repair history of the equipment used by the staff with staff_id 'STAFF123' during maintenance tasks?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the detailed repair history of equipment used by staff memb... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"role": "user",
"content": "Show all rooms that are on floor 3."
},
{
"role": "assistant",
"content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;"
},
{
"role": "user",
"content": "For these rooms, include the property name and room 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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Find all smart contracts where the code length is greater than 1000 characters."
},
{
"role": "assistant",
"content": "SELECT contract_id, creator_address, LENGTH(code) AS code_length FROM blockchain.smart_contracts WHERE LENGTH(code) > 1000;"
},
{
"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 blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
|
[
{
"role": "user",
"content": "For each group chat, list its ID, name, creation time, and the creation time of the next group chat created after it, ordered by creation time."
},
{
"role": "assistant",
"content": "SELECT conversation_id, group_name, created_at, LEAD(created_at) OVER (ORDER BY cre... | You are an SQL statement expert. Given the table 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.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR... |
[
{
"role": "user",
"content": "Find all pairs of transactions where both transactions have the same nonce and from_address, but different transaction_id. Show both transaction IDs, the shared from_address, shared nonce, and their block numbers."
},
{
"role": "assistant",
"content": "SELECT t1.tra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"role": "user",
"content": "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": "我想查看所有检查记录中检查员的ID和检查结果,同时统计每个检查员的检查次数。"
},
{
"role": "assistant",
"content": "db.inspections.aggregate([\n {\n $group: {\n _id: '$inspector_employee_id',\n total_inspections: { $count: {} },\n results: { $push: '$result' }\n }\n },\n {\n $... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id... |
[
{
"role": "user",
"content": "I need the average capacity of vehicles for each fuel_type."
},
{
"role": "assistant",
"content": "SELECT fuel_type,\n AVG(capacity) AS avg_capacity\nFROM transportation.vehicles\nGROUP BY fuel_type;"
},
{
"role": "user",
"content": "Only include f... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "List all 'exists'-status coins from sui_coins_metadata with more than 8 decimals, showing coin_type, symbol, name, and decimals."
},
{
"role": "assistant",
"content": "SELECT coin_type, symbol, name, decimals FROM sui_coins_metadata WHERE status = 'exists' AND decim... | You are an SQL statement expert. Given the table 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 users whose password hash contains the substring 'abc'."
},
{
"role": "assistant",
"content": "SELECT user_id, username, password_hash FROM blockchain.users WHERE password_hash LIKE '%abc%';"
},
{
"role": "user",
"content": "Also include their 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 blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text )
CREATE TABLE blockchain.users ( ... |
[
{
"role": "user",
"content": "How many pairs of distinct locations are there that share the same state or province but are in different cities?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM transportation.locations AS l1 JOIN transportation.locations AS l2 ON l1.state_province = l2... | You are an SQL statement expert. Given the table 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": "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": "List the post_id and the count of distinct hashtags associated with each post that has at least 3 hashtags."
},
{
"role": "assistant",
"content": "SELECT ph.post_id, COUNT(DISTINCT ph.hashtag_id) AS hashtag_count FROM social_media.post_hashtags ph GROUP BY ph.post_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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"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": "List all ERC20 tokens where the price is between $1 and $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... | You are an SQL statement expert. Given the table 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": "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": "Calculate the total quantity traded for each asset, showing the asset name and symbol."
},
{
"role": "assistant",
"content": "SELECT T1.name, T1.symbol, SUM(T2.quantity) FROM trading_platform.assets AS T1 JOIN trading_platform.trades AS T2 ON T1.asset_id = T2.asset_... | You are an SQL statement expert. Given the table 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": "How many agencies exist for each jurisdiction level?"
},
{
"role": "assistant",
"content": "SELECT jurisdiction_level, COUNT(*) AS agency_count FROM government_services.agencies GROUP BY jurisdiction_level;"
},
{
"role": "user",
"content": "Only show 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 government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "How many customers are there for each status?"
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) FROM financial_services.customers GROUP BY status"
},
{
"role": "user",
"content": "Only show statuses where the count is greater than 50."
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Show me all claims along with the related customer's full name and the policy number for incidents that occurred in 2024."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.incident_date, c.description, cu.first_name || ' ' || cu.last_name AS customer_full_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "List all properties and the room types they offer, including the base rate for each room type."
},
{
"role": "assistant",
"content": "SELECT T1.property_name, T2.type_name, T2.base_rate FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room_ty... | You are an SQL statement expert. Given the table 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 me all trips that originated from locations in California, including the trip ID, origin city, and destination city."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, o.city AS origin_city, d.city AS destination_city FROM transportation.trips t JOIN 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.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "Find all pairs of users where the registration times are within 30 minutes of each other, and show both user IDs, usernames, and the time difference in minutes."
},
{
"role": "assistant",
"content": "SELECT u1.user_id AS user1_id, u1.username AS user1_name, u2.user_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "List users who have received notifications triggered by another user (non-system notifications). Show the recipient username, notification type, and the sender username."
},
{
"role": "assistant",
"content": "SELECT T1.username AS recipient_username, T2.notification... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "For each 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": "List all tokens with a price below $1 and a 24-hour trading volume over $5 million."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE price < 1 AND total_volume::numeric > 5000000;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol ch... |
[
{
"role": "user",
"content": "Which wallets hold at least 100 units of any ERC1155 NFT, and what is the token ID and contract address of the NFT for each such holding?"
},
{
"role": "assistant",
"content": "SELECT wallet_address, contract_address, token_id, amount\nFROM nft_holders\nWHERE contra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "What is the total revenue generated by ticket sales at the station with ID 'ST101' for the past month?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the revenue generated by ticket sales as this data is not available in the cur... | 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": "Show all comments that are replies, including the comment_id, parent_comment_id, and post_id."
},
{
"role": "assistant",
"content": "SELECT comment_id, parent_comment_id, post_id FROM social_media.comments WHERE parent_comment_id 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 social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "For each user, show their user ID and the count of unique wallet addresses they own."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(DISTINCT address) FROM wallets GROUP BY 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.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "Find cases where an address received tokens in one transfer and then sent tokens in another. List the receive transfer_id, the send transfer_id, the address, and both transfer values."
},
{
"role": "assistant",
"content": "SELECT recv.transfer_id AS receive_transfer... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "For each doctor, count the number of chronic diagnoses they have made. Show the doctor's full name and the count."
},
{
"role": "assistant",
"content": "SELECT doc.first_name, doc.last_name, COUNT(d.diagnosis_id) FROM healthcare.doctors doc JOIN healthcare.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.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "Show me the total transaction amount by transaction_type for all transactions processed by employees in the 'Trading' department, along with their department name."
},
{
"role": "assistant",
"content": "SELECT t.transaction_type, SUM(t.amount) AS total_amount, e.dep... | You are an SQL statement expert. Given the table 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": "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 customers who have missing contact information (either phone number or email is null), along with their state and city."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone_number IS NULL O... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "List all DApps along with the number of metadata entries linked to each, even if the DApp has no linked metadata."
},
{
"role": "assistant",
"content": "SELECT d.name, d.url, COUNT(m.metadata_id) AS metadata_count\nFROM trading_platform.dapps d\nLEFT JOIN trading_pl... | You are an SQL statement expert. Given the table 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": "List all narratives with a trend rank in the top 10 and a 24-hour trading volume over $100 million."
},
{
"role": "assistant",
"content": "SELECT narrative, trend_rank, volume_24h FROM narrative_info WHERE trend_rank <= 10 AND volume_24h > 100000000 ORDER BY trend_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 narrative_info (",
"narrative character varying(512) NOT NULL, -- the id of narrative",
"top_3_coins text, --... |
[
{
"role": "user",
"content": "Get the total balance of each SUI coin per coin_type, including symbol and name from metadata."
},
{
"role": "assistant",
"content": "SELECT sc.coin_type,\n scm.symbol,\n scm.name,\n SUM(CAST(sc.balance AS NUMERIC)) AS total_balance\nFROM sui_coins... | You are an SQL statement expert. Given the table 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": "What is the total payment amount for each currency recorded in the payments table?"
},
{
"role": "assistant",
"content": "SELECT currency , sum(amount) FROM government_services.payments GROUP BY currency"
},
{
"role": "user",
"content": "Now, only show ... | You are an SQL statement expert. Given the table 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 hashtags have been created in March 2024?"
},
{
"role": "assistant",
"content": "```sql\nSELECT COUNT(*) AS march_2024_hashtag_count\nFROM social_media.hashtags\nWHERE created_at >= '2024-03-01'\n AND created_at < '2024-04-01';\n```"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "What is the schedule of trains arriving at platform 1A at station XYZ on December 25th, 2023?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about train schedules or specific arrival times as this data is not included in the platfo... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.