conversations listlengths 2 8 | system stringlengths 276 7.22k |
|---|---|
[
{
"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 the full names and dates of birth for all patients who do not have a phone number on record."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE phone_number IS NULL OR TRIM(phone_number) = '';"
}
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "For each driver, find the other driver whose license_expiry_date is the next one after theirs. Show both IDs, names and their expiry dates."
},
{
"role": "assistant",
"content": "SELECT\n d1.driver_id AS driver_id,\n d1.first_name || ' ' || d1.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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "List all users who have bought assets, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id, T1.address FROM wallets AS T1 JOIN trades AS T2 ON T1.user_id = T2.buyer_id;"
},
{
"role": "user",
"content": "Fi... | You are an SQL statement expert. Given the table 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": "Show the full name of each manager and the average commission rate of the agents who report directly to them. Only include managers who have at least one reporting agent."
},
{
"role": "assistant",
"content": "SELECT T2.first_name AS manager_first_name, T2.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 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 3 smart money addresses by profit across all chains, along with their most profitable token and chain information."
},
{
"role": "assistant",
"content": "SELECT address, profit, most_profit_token, chain\nFROM smart_money_profit\nORDER BY profit DESC\... | You are an SQL statement expert. Given the table 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 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": "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": "Find all pairs of distinct routes that share the same origin location ID. List the route IDs and route numbers for both routes in each pair, along with the shared origin location ID."
},
{
"role": "assistant",
"content": "SELECT r1.route_id AS route1_id, r1.route_nu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... |
[
{
"role": "user",
"content": "For each group chat, can you show me each participant's username and the date they joined the chat?"
},
{
"role": "assistant",
"content": "SELECT u.username, c.group_name, cp.joined_at\nFROM social_media.conversation_participants cp\nJOIN social_media.users u ON cp.... | You are an SQL statement expert. Given the table 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": "List the content and sent time for messages sent by user 'U101'."
},
{
"role": "assistant",
"content": "SELECT content, sent_at FROM social_media.messages WHERE sender_user_id = 'U101';"
},
{
"role": "user",
"content": "Could you also include the group 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.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "For each NFT collection on Ethereum, calculate the number of unique tokens and the average rarity_score. Show contract_address, token_count, and avg_rarity."
},
{
"role": "assistant",
"content": "SELECT nm.contract_address,\n COUNT(DISTINCT nm.token_id) AS tok... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "Show the number of active agents in each license state."
},
{
"role": "assistant",
"content": "SELECT license_state,\n COUNT(*) AS active_agent_count\nFROM insurance.agents\nWHERE status = 'active'\nGROUP BY license_state;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
[
{
"role": "user",
"content": "What is the reason behind the cost variation for maintenance of asset_id 'ASSET456' over the past year?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the reasons behind cost variations for maintenance. The data in the maintenan... | 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": "List all rooms that have a 'Jacuzzi' feature, including the room_number, property_id, type_name, and base_rate."
},
{
"role": "assistant",
"content": "SELECT r.room_number,\n r.property_id,\n rt.type_name,\n rt.base_rate\nFROM hospitality_technolog... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat... |
[
{
"role": "user",
"content": "List all agencies that do not have a website URL specified. Return their agency_id, agency_name, and main_phone_number."
},
{
"role": "assistant",
"content": "SELECT agency_id, agency_name, main_phone_number FROM government_services.agencies WHERE website_url IS NUL... | You are an SQL statement expert. Given the table 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": "Show me the username and email of all users who own at least one wallet."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username, T1.email FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.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 blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text )
CREATE TABLE blockchain.users ( ... |
[
{
"role": "user",
"content": "List all pairs of hashtags that were created on the same date. Show both tag names and the creation date."
},
{
"role": "assistant",
"content": "SELECT a.tag_name AS tag1, b.tag_name AS tag2, a.created_at::date AS created_date\nFROM social_media.hashtags a\nJOIN soc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre... |
[
{
"role": "user",
"content": "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": "Calculate the average number of days between when an incident occurred and when the claim was reported, but only for claims that were settled in the year 2023."
},
{
"role": "assistant",
"content": "SELECT\n AVG(EXTRACT(EPOCH FROM (reported_date - incident_date)) /... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "Show me wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount, sorted by amount in descending order."
},
{
"role": "assistant",
"content": "SELECT b.wallet_address, t.symbol, b.amount FROM erc20_balances b JOIN sui_coin... | You are an SQL statement expert. Given the table 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": "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": "Show me all accounts (account_id, account_number, balance) that have a balance greater than $50,000 and are in USD currency, along with the security details (ticker_symbol, security_name) for securities traded on the same exchange as the account's last_updated_at date."
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"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": "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": "For each player and game pair, please show the total number of achievements unlocked by the player in that game."
},
{
"role": "assistant",
"content": "SELECT gs.player_id, gs.game_id, COUNT(pa.achievement_id) AS achievements_unlocked\nFROM gaming_technology.game_se... | You are an SQL statement expert. Given the table 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": "I want to find the total number of players currently connected per region for each game."
},
{
"role": "assistant",
"content": "SELECT\n s.region,\n s.game_id,\n SUM(s.current_players) AS total_players\nFROM gaming_technology.servers s\nGROUP BY\n s.region,\n 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "List all loans (loan_id, loan_type, principal_amount) that have a current principal balance less than 25% of the original principal amount, along with their account_id and the difference between principal_amount and current_principal_balance."
},
{
"role": "assistant",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b... |
[
{
"role": "user",
"content": "Find all pairs of different insurance records that share the same group_number, and show group_number, the patient_insurance_id of both records, and their corresponding patient_ids."
},
{
"role": "assistant",
"content": "SELECT a.group_number,\n a.patient_insu... | You are an SQL statement expert. Given the table 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": "Provide a count of notifications, separated by whether they have been read or not."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN T1.read_at IS NULL THEN 'Unread' ELSE 'Read' END, count(T1.notification_id) FROM trading_platform.notifications AS T1 GROUP BY ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"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": "Could you list each game_id along with the count of hidden achievements and the count of visible achievements?"
},
{
"role": "assistant",
"content": "SELECT game_id,\n SUM(CASE WHEN hidden THEN 1 ELSE 0 END) AS hidden_count,\n SUM(CASE WHEN NOT hidden TH... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points.... |
[
{
"role": "user",
"content": "Can you help me fetch the inventory details for components associated with a specific aircraft build, including the batch number, quantity, and warehouse location?"
},
{
"role": "assistant",
"content": "MATCH (ab:AircraftBuild {build_id: 'specific_build_id'})-[:IS_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
Node Label ':AircraftModel'. Properties: { model_id: String (Constraint: UNIQUE), model_name: Str... |
[
{
"role": "user",
"content": "List the names of employees and the agency they work for who have scheduled at least one appointment. Show the employee's first name, last name, and agency_id."
},
{
"role": "assistant",
"content": "SELECT DISTINCT e.first_name, e.last_name, e.agency_id\nFROM govern... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... |
[
{
"role": "user",
"content": "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": "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": "List all reviews with their property IDs and overall ratings where the rating is 4 or higher."
},
{
"role": "assistant",
"content": "SELECT review_id, property_id, rating_overall FROM hospitality_technology.reviews WHERE rating_overall >= 4;"
},
{
"role": "u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id.text, property_id.text, guest_id.text, room_id.text, room_type_id.... |
[
{
"role": "user",
"content": "Show a list of all game developers with their name and founded year."
},
{
"role": "assistant",
"content": "SELECT\n name,\n founded_year\nFROM gaming_technology.developers;"
},
{
"role": "user",
"content": "Please filter the list to only include devel... | You are an SQL statement expert. Given the table 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": "List all unique claim handler IDs present in the claims table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT claim_handler_id FROM insurance.claims WHERE claim_handler_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 insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"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": "List all claim documents along with the beneficiary first and last names and their relationship for policies where a document of type 'MEDICAL_REPORT' exists."
},
{
"role": "assistant",
"content": "SELECT cd.document_id, cd.claim_id, cd.file_name, cd.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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "What is the current location of train number Acela 2151?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to real-time location data for trains. The database only contains static information such as train ID, model, capacity, and maintenance... | 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 the symbol, name, and total supply for all SUI coins with status 'active'."
},
{
"role": "assistant",
"content": "SELECT scm.symbol, scm.name, scm.coin_type, scm.total_supply\nFROM sui_coins_metadata scm\nWHERE scm.status = 'active';"
},
{
"role": "user... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "Provide a list of all vehicles and the total quantity of fuel refueled for each vehicle."
},
{
"role": "assistant",
"content": "SELECT T1.license_plate, sum(T2.quantity) FROM transportation.vehicles AS T1 JOIN transportation.fuel_logs AS T2 ON T1.vehicle_id = T2.veh... | You are an SQL statement expert. Given the table 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": "List all patients who have non-primary insurance plans from providers containing 'Care' in their name, including the policy number and expiration date."
},
{
"role": "assistant",
"content": "SELECT pi.patient_id, pi.policy_number, pi.expiration_date FROM healthcare.... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the doctor
first_name ... |
[
{
"role": "user",
"content": "Show me all in-progress trips with their current locations (origin_location_id) and destinations, along with the scheduled vs actual departure time difference in minutes."
},
{
"role": "assistant",
"content": "SELECT trip_id, origin_location_id, destination_location... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips (
trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance
... |
[
{
"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": "List all spa services (category = 'Wellness') with their names, prices, and units, ordered by price in descending order."
},
{
"role": "assistant",
"content": "SELECT service_name, price, unit FROM hospitality_technology.services WHERE category = 'Wellness' 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 hospitality_technology.guests (
guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil... |
[
{
"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... |
[
{
"role": "user",
"content": "Find any two claims made by the same customer on the same day. Return customer_id, the two claim IDs, and the incident date."
},
{
"role": "assistant",
"content": "SELECT c1.customer_id,\n c1.claim_id AS claim1_id,\n c2.claim_id AS claim2_id,\n DAT... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "Which employees have verified more than 5 documents in the last 30 days? Return the employee's full name, department, and the number of verifications."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS full_name, e.department, COUNT(... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "How many claims were reported in the last 90 days?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM claims WHERE reported_date >= CURRENT_DATE - INTERVAL '90 days'"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "Show me the content of all comments that have received at least one like."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.content FROM social_media.comments AS T1 JOIN social_media.likes AS T2 ON T1.comment_id = T2.comment_id;"
},
{
"role": "user",... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "List each insurance product's name and type, along with the number of active policies and the total premium_amount collected for those policies. Only include products that have at least one active policy."
},
{
"role": "assistant",
"content": "SELECT p.product_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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "For each citizen who has made at least one payment, show the citizen's full name, number of payments, and total amount paid, grouped by currency."
},
{
"role": "assistant",
"content": "SELECT\n c.first_name || ' ' || c.last_name AS full_name,\n p.currency,\n 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 government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "Show me all documents uploaded by lawyers from law firms located in 'New York'. Include the document name, upload timestamp, the first and last name of the uploading lawyer, and the firm name."
},
{
"role": "assistant",
"content": "SELECT d.document_name, d.upload_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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "For each route, show the route number and the total number of trips associated with it."
},
{
"role": "assistant",
"content": "SELECT T2.route_number, count(T1.trip_id) FROM transportation.trips AS T1 JOIN transportation.routes AS T2 ON T1.route_id = T2.route_id GRO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "How many distinct users have sent messages in each conversation? Return conversation_id and user_count."
},
{
"role": "assistant",
"content": "SELECT conversation_id,\n COUNT(DISTINCT sender_user_id) AS user_count\nFROM social_media.messages\nGROUP BY conversa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "Show me all smart contracts created by addresses that have created more than 5 contracts, along with the count of contracts each creator has made."
},
{
"role": "assistant",
"content": "SELECT sc.contract_id, sc.creator_address, COUNT(*) OVER (PARTITION BY sc.creato... | You are an SQL statement expert. Given the table 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": "Show all SUI coins with 'exists' status and more than 8 decimal places. Display coin_type, symbol, name, and decimals."
},
{
"role": "assistant",
"content": "SELECT coin_type, symbol, name, decimals\nFROM sui_coins_metadata\nWHERE status = 'exists' AND decimals > 8;... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_i... |
[
{
"role": "user",
"content": "How many active insurance policies does each patient have? Return patient_id and active_policy_count."
},
{
"role": "assistant",
"content": "SELECT patient_id,\n COUNT(*) AS active_policy_count\nFROM healthcare.patient_insurance\nWHERE expiration_date IS NULL\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show pairs of time entries for the same lawyer on the same date with different billing rates, including both entry IDs, the lawyer ID, the work date, and both billing rates."
},
{
"role": "assistant",
"content": "SELECT a.entry_id AS entry1_id, b.entry_id AS entry2_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "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": "List all medical records created in the last 7 days, including patient_id, doctor_id, and record_date."
},
{
"role": "assistant",
"content": "SELECT patient_id, doctor_id, record_date FROM healthcare.medical_records WHERE created_at >= CURRENT_DATE - INTERVAL '7 day... | You are an SQL statement expert. Given the table 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.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam... |
[
{
"role": "user",
"content": "For each fundraising round in 2022 and 2023, list the round name, the year, the total investment_value, and the count of distinct projects. Also include the average market_cap of associated tokens by matching project_name to token_symbol in token_basic_info."
},
{
"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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "How many insurance policies does each patient have? Return patient_id and policy_count."
},
{
"role": "assistant",
"content": "SELECT patient_id,\n COUNT(*) AS policy_count\nFROM healthcare.patient_insurance\nGROUP BY patient_id;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "For each reservation, show me the guest's full name, the property name, and the room type name."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS guest_full_name, p.property_name, rt.type_name AS room_type_name\nFR... | You are an SQL statement expert. Given the table 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": "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": "How many documents of each type exist in the system? Show the document type and the count."
},
{
"role": "assistant",
"content": "SELECT document_type, COUNT(*) AS document_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.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "Count how many posts have media attachments."
},
{
"role": "assistant",
"content": "SELECT count(*) FROM social_media.posts WHERE media_url 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.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Find appointments that are longer than 30 minutes."
},
{
"role": "assistant",
"content": "SELECT * FROM legal_services.appointments WHERE end_time IS NOT NULL AND start_time IS NOT NULL AND end_time > start_time + INTERVAL '30 minutes'"
}
] | You are an SQL statement expert. Given the table 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.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ... |
[
{
"role": "user",
"content": "Show each policy number and the total amount paid for it across all premium payments received so far."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, SUM(T2.amount_paid) FROM insurance.policies AS T1 JOIN insurance.premium_payments AS T2 ON T1.policy... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all tokens from the token_dexpool_info table with a liquidity over $10 million and a positive 6-hour price change percentage on the Ethereum chain."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, liquidity, price_change_percentage_6h FRO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE narrative_info (",
"narrative character varying(512) NOT NULL, -- the id of narrative",
"top_3_coins text, --... |
[
{
"role": "user",
"content": "What is the total estimated_loss and average settlement_amount for all claims with status 'Approved'?"
},
{
"role": "assistant",
"content": "SELECT SUM(estimated_loss) AS total_estimated_loss,\n AVG(settlement_amount) AS average_settlement\nFROM insurance.clai... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "Show the total number of customers in each state."
},
{
"role": "assistant",
"content": "SELECT\n state,\n COUNT(customer_id)\nFROM insurance.customers\nGROUP BY\n state;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "List all claim IDs that have both an 'Accident Report' and a 'Damage Assessment' document, and show the earliest upload timestamp for each type."
},
{
"role": "assistant",
"content": "SELECT a.claim_id,\n MIN(a.uploaded_at) AS accident_report_date,\n MIN... | You are an SQL statement expert. Given the table 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.claim_documents ( document_id.text, claim_id.text, document_type.text, file_name.text, file_path.text, file_s... |
[
{
"role": "user",
"content": "List all payments made by credit card, including the payment ID, guest ID, amount, status, and card last four digits. Order by payment amount descending."
},
{
"role": "assistant",
"content": "SELECT payment_id, guest_id, amount, status, card_last_four\nFROM hospita... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.payments ( payment_id text PRIMARY KEY, reservation_id text, guest_id text, bill_id text, amount... |
[
{
"role": "user",
"content": "What is the total number of drivers hired each year? Provide the hire_year and driver_count."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM hire_date) AS hire_year,\n COUNT(*) AS driver_count\nFROM transportation.drivers\nGROU... | You are an SQL statement expert. Given the table 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": "Retrieve the first_name, last_name, and email of all passengers who have never made a booking."
},
{
"role": "assistant",
"content": "SELECT\n p.first_name,\n p.last_name,\n p.email\nFROM transportation.passengers p\nLEFT JOIN transportation.bookings b\n ON p.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 transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... |
[
{
"role": "user",
"content": "List pairs of invoice numbers for the same case, including their issue dates."
},
{
"role": "assistant",
"content": "SELECT T1.invoice_number AS invoice1_number, T2.invoice_number AS invoice2_number, T1.case_id, T1.issue_date AS invoice1_issue_date, T2.issue_date 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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "Show each citizen's first and last notification IDs based on sent_at."
},
{
"role": "assistant",
"content": "WITH bounds AS (\n SELECT citizen_id,\n MIN(sent_at) AS first_sent,\n MAX(sent_at) AS last_sent\n FROM government_services.notifications\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.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_sub... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2