conversations listlengths 2 8 | system stringlengths 290 7.86k |
|---|---|
[
{
"role": "user",
"content": "Provide a count of citizens registered per calendar year."
},
{
"role": "assistant",
"content": "SELECT CAST(EXTRACT(YEAR FROM registration_date) AS INTEGER) AS registration_year, COUNT(*) AS citizen_count FROM government_services.citizens GROUP BY 1 ORDER BY 1;"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List 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": "What is the total quantity and total cost of fuel consumed for each fuel type recorded in the fuel logs?"
},
{
"role": "assistant",
"content": "SELECT fuel_type, SUM(quantity) AS total_quantity, SUM(total_cost) AS total_cost FROM transportation.fuel_logs GROUP BY fu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin... |
[
{
"role": "user",
"content": "List all pairs of achievements in the same game where the difference in their points is greater than 50."
},
{
"role": "assistant",
"content": "SELECT a1.game_id,\n a1.name AS achv1,\n a2.name AS achv2,\n ABS(a1.points - a2.points) AS point_dif... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with the names of their managers and the count of active staff members at each property."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, s.first_name || ' ' || s.l... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "For each game, show the game_id, title, the number of servers currently online, and the total current_players on those servers."
},
{
"role": "assistant",
"content": "SELECT g.game_id, g.title, COUNT(s.server_id) AS online_servers, SUM(s.current_players) AS total_on... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "特定のプラットフォームID 'plat_123' に関連するメンテナンス記録を取得するのを手伝っていただけますか?また、記録のステータスも含めてください。"
},
{
"role": "assistant",
"content": "SMEMBERS platform:plat_123:maintenance\nHGETALL maintenance_record:<record_id>"
},
{
"role": "user",
"content": "ステータスが 'Completed' の記録だけ... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for ticket details. Key format: ticket:<ticket_id>
// HSET ticket:tkt_1a2b ticket_i... |
[
{
"role": "user",
"content": "Show me all reservations with their guest IDs and room IDs where the total amount is greater than $500 and the status is 'Confirmed', ordered by check-in date."
},
{
"role": "assistant",
"content": "SELECT reservation_id, guest_id, room_id, check_in_date, total_amou... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"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 all in-game items' names, types, and rarity along with their total cost in USD, for items that belong to games released on or after 2021-01-01."
},
{
"role": "assistant",
"content": "SELECT i.item_name, i.item_type, i.rarity, i.cost_amount\nFROM gaming_technolo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "Retrieve all documents uploaded in 2024, showing document_id, uploaded_by, and uploaded_at."
},
{
"role": "assistant",
"content": "SELECT document_id,\n uploaded_by,\n uploaded_at\nFROM insurance.claim_documents\nWHERE uploaded_at >= '2024-01-01'\n AND ... | You are an SQL statement expert. Given the table 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": "For the 'DeFi' narrative, what is the average ROI and the total net inflow (usd_value where type=1) from smart money token inflow?"
},
{
"role": "assistant",
"content": "SELECT AVG(sm.roi) AS avg_roi, SUM(smt.usd_value) AS total_net_inflow\nFROM smart_money_token_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 token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "List the total value and count of transactions for each status, ordered by total value descending."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS transaction_count, SUM(value) AS total_value\nFROM web3.transactions\nGROUP BY status\nORDER BY total... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.numeric, gas_used.integer, gas_price... |
[
{
"role": "user",
"content": "How many appointments were created in the last 24 hours?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM healthcare.appointments WHERE created_at >= NOW() - INTERVAL '24 hours';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "Find all patients who have both an email address and an emergency contact listed, and show their names, email, and emergency contact phone numbers."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, emergency_contact_phone FROM healthcare.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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "List the top 5 most used services across all properties. Show service_name and total quantity ordered, ordered by quantity descending."
},
{
"role": "assistant",
"content": "SELECT s.service_name,\n SUM(o.quantity) AS total_quantity\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.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show the tokens with a negative net flow this month on all chains."
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, net_flow FROM smart_money_token_performance WHERE net_flow < 0 AND date_trunc('month', CURRENT_DATE) = date_trunc('month', now());"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "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 documents that have multiple versions, including document_name, case_id, and the count of versions."
},
{
"role": "assistant",
"content": "SELECT document_name,\n case_id,\n COUNT(*) AS version_count\nFROM legal_services.documents\nGROUP BY docu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "I need to check the inventory status of components, including their batch details and warehouse location."
},
{
"role": "assistant",
"content": "MATCH (i:InventoryBatch)-[:IS_INSTANCE_OF]->(c:Component)\nRETURN c.component_id, c.component_name, i.inventory_record_id... | 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 ':Component'. Properties: { component_id: String (Constraint: UNIQUE), part_number: St... |
[
{
"role": "user",
"content": "List all fuel refueling events with the refueled vehicle's make and model, the fuel type used, and the fueling location ID."
},
{
"role": "assistant",
"content": "SELECT fl.fuel_log_id, fl.log_timestamp, v.make, v.model, fl.fuel_type, fl.quantity, fl.unit, fl.total_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "How many reviews have been submitted for each review_source?"
},
{
"role": "assistant",
"content": "SELECT review_source, COUNT(*) AS review_count\nFROM hospitality_technology.reviews\nGROUP BY review_source;"
},
{
"role": "user",
"content": "Now, show o... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reviews ( review_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, ... |
[
{
"role": "user",
"content": "Which doctors have issued prescriptions with a route of 'Oral'? Please show doctor_id and the number of such prescriptions they have written."
},
{
"role": "assistant",
"content": "SELECT doctor_id, COUNT(*) AS oral_prescription_count\nFROM healthcare.prescriptions\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.prescriptions (
prescription_id character varying(64) NOT NULL, -- unique identifier for the prescriptio... |
[
{
"role": "user",
"content": "I want to know, for each conversation participant, how many unread messages they have. Return participant_id, conversation_id, and unread_count."
},
{
"role": "assistant",
"content": "SELECT cp.participant_id,\n cp.conversation_id,\n COUNT(m.message_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 social_media.posts (
post_id character varying(64) NOT NULL, -- unique identifier for the post
user_id characte... |
[
{
"role": "user",
"content": "List all cryptocurrency assets that have been traded at least 50 times, along with their average trade price."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count, AVG(t.price) AS avg_price FROM trading_platfor... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "List all SUI NFT objects with the status 'exists', showing the object_id, name, and owner."
},
{
"role": "assistant",
"content": "SELECT object_id, name, owner\nFROM sui_nfts\nWHERE status = 'exists';"
},
{
"role": "user",
"content": "Can you also add 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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List each citizen's first and last name along with the first and last name of another citizen who shares the same last name. Show each pair only once."
},
{
"role": "assistant",
"content": "SELECT c1.first_name || ' ' || c1.last_name AS citizen_name,\n c2.firs... | You are an SQL statement expert. Given the table 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": "Find the service locations that are not accessible and located in the state of 'California'. List their name, address, and city."
},
{
"role": "assistant",
"content": "SELECT location_name , address , city FROM government_services.service_locations WHERE is_access... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.service_locations ( location_id text, agency_id text, location_name text, address text, city text, ... |
[
{
"role": "user",
"content": "Show me the top 5 users by the total trade volume (quantity * price) as buyers, along with their email addresses and the number of distinct assets they traded."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(DISTINCT t.asset_id) AS distinct_a... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"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 each payment method, the total amount paid, and the number of payments for each method for services in the 'Education' category."
},
{
"role": "assistant",
"content": "SELECT p.payment_method, SUM(p.amount) AS total_amount, COUNT(p.payment_id) AS payment_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.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m... |
[
{
"role": "user",
"content": "What are the fuel consumption rates per hour for the Boeing 747-8 model?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "List 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": "Get a list of room types along with their property name and the count of rooms currently Available for each type."
},
{
"role": "assistant",
"content": "SELECT rt.type_name, p.property_name, COUNT(r.room_id) AS available_rooms_count\nFROM hospitality_technology.room... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Find reservations where the same guest has overlapping stays in the same property."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id AS res1,\n r2.reservation_id AS res2,\n r1.guest_id,\n r1.property_id\nFROM hospitality_technology.re... | You are an SQL statement expert. Given the table 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": "List all appointments for the client with ID 'client_001' showing the lawyer's ID, appointment subject, and start time."
},
{
"role": "assistant",
"content": "SELECT a.lawyer_id, a.subject, a.start_time\nFROM legal_services.appointments a\nWHERE a.client_id = 'clien... | You are an SQL statement expert. Given the table 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": "List all claims (claim ID, incident date, status) for policies where at least one beneficiary has a percentage share greater than 50%. Also include the policy number."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.claim_id, T1.incident_date, T1.status, 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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply on Ethereum, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, symbol, contract_address FROM token_metas WHERE is_erc20 = 1 ORDER BY CAST(total_sup... | You are an SQL statement expert. Given the table 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 bookings for trips going to locations in 'California' state, including the passenger's first name, last name, booking_id, and the city of the destination."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, b.booking_id, l.city AS de... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the location
n... |
[
{
"role": "user",
"content": "List all Sui NFT collections where the owner is not null, including their name and collection_type."
},
{
"role": "assistant",
"content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL;"
},
{
"role": "user",
"content": "Can you also ... | You are an SQL statement expert. Given the table 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": "Find the total number of documents uploaded by each citizen along with their first and last names."
},
{
"role": "assistant",
"content": "SELECT c.citizen_id, c.first_name, c.last_name, COUNT(d.document_id) AS document_count\nFROM government_services.citizens c\nLEF... | You are an SQL statement expert. Given the table 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": "Find all medical records where the treatment plan includes 'physical therapy' and the patient has an active primary insurance plan, showing the patient ID, record date, and insurance provider details."
},
{
"role": "assistant",
"content": "SELECT mr.patient_id, mr.r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "Show me the top 5 users who have interacted with DApps, along with the count of distinct DApps they interacted with and their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT w.user_id, COUNT(DISTINCT d.dapp_id) AS dapp_count, w.address FROM trading_p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Show me the average market cap and average 24-hour price change percentage for tokens on each chain."
},
{
"role": "assistant",
"content": "SELECT chain, AVG(market_cap) AS average_market_cap, AVG(price_change_percentage_24h) AS average_price_change_24h FROM token_b... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character var... |
[
{
"role": "user",
"content": "List all payments, showing the payment amount, currency, and the guest's full name who made the payment."
},
{
"role": "assistant",
"content": "SELECT p.payment_id, p.amount, p.currency_code, g.first_name, g.last_name FROM hospitality_technology.payments AS p 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 text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "How many employees work in each department? List the department name and the count."
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) FROM government_services.employees GROUP BY department"
},
{
"role": "user",
"content": "Only show depa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Find the total number of likes made on posts versus comments. Show two columns: like_type (either 'post' or 'comment') and like_count."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN post_id IS NOT NULL THEN 'post' ELSE 'comment' END AS like_type, COUNT(*) A... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
|
[
{
"role": "user",
"content": "Provide a report of each user with their username and the count of all log entries from the last 30 days."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(l.log_id) AS log_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.log... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "我想查看所有检查记录中检查员的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": "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": "Show me the top 5 NFT collections with the highest number of unique owners, along with their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT nc.name, nc.contract_address, COUNT(DISTINCT nh.wallet_address) AS unique_owners FROM nft_collect... | You are an SQL statement expert. Given the table 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": "Give me the count of clients who registered in each month of 2023."
},
{
"role": "assistant",
"content": "SELECT TO_CHAR(date_registered, 'YYYY-MM') AS reg_month, COUNT(*) AS client_count FROM legal_services.clients WHERE date_registered BETWEEN '2023-01-01' AND '20... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "I need to compare consecutive daily close_prices for each security to find when the close_price increased compared to the previous day."
},
{
"role": "assistant",
"content": "SELECT a.security_id, b.data_timestamp AS prev_date, b.close_price AS prev_close, a.data_ti... | You are an SQL statement expert. Given the table 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 bigint, security_id text, data_timestamp timestamp, open_price numeric, ... |
[
{
"role": "user",
"content": "Which route numbers connect locations with a distance less than 80 km and more than 5 words in their description? Include the route type in the results."
},
{
"role": "assistant",
"content": "SELECT route_number, type FROM transportation.routes WHERE distance_km < 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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"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": "For each ERC1155 NFT contract on Ethereum, show the `contract_address`, `token_id`, total amount held across all wallets, and number of unique holders."
},
{
"role": "assistant",
"content": "SELECT nh.contract_address,\n nh.token_id,\n SUM(CAST(nh.amount... | You are an SQL statement expert. Given the table 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... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2