conversations listlengths 2 8 | system stringlengths 288 8.4k |
|---|---|
[
{
"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": "List all NFT collections where the floor price is greater than 0.5 ETH, including their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address FROM nft_collections WHERE CAST(floor_price AS decimal) > 0.5 AND floor_price_s... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "How many 'ApprovalForAll' events are recorded for each ERC1155 contract address in the `erc1155_approval_for_all` table?"
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_addres... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"role": "user",
"content": "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": "For each claim, show the corresponding product_type of the insurance product for the related policy."
},
{
"role": "assistant",
"content": "SELECT cl.claim_id, ip.product_type\nFROM insurance.claims cl\nJOIN insurance.policies p ON cl.policy_id = p.policy_id\nJOIN i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "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": "Count how many diagnoses were recorded each month in 2024. Show the month (as the first day of the month) and the count."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', diagnosis_date)::date AS diagnosis_month, COUNT(*) FROM healthcare.diagnoses WH... | You are an SQL statement expert. Given the table 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, -- unique identifier for the appointment
... |
[
{
"role": "user",
"content": "Show me the top 3 narratives by trend rank, along with their top 3 tokens and 7-day price change percentage."
},
{
"role": "assistant",
"content": "SELECT ni.narrative, ni.top_3_coins, ni.price_change_percentage_7d FROM narrative_info ni ORDER BY ni.trend_rank ASC L... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "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": "How many likes were given to comments in June 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS comment_likes_count\nFROM social_media.likes\nWHERE comment_id IS NOT NULL \n AND DATE_TRUNC('month', created_at) = '2024-06-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, user_id char... |
[
{
"role": "user",
"content": "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": "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": "Can you show me the first and last names of employees along with the first and last names of their managers?"
},
{
"role": "assistant",
"content": "SELECT e.first_name AS employee_first_name, e.last_name AS employee_last_name, m.first_name AS manager_first_name, m.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 government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, depa... |
[
{
"role": "user",
"content": "How many lawyers who are partners were hired in each year? Show the hire year and the count."
},
{
"role": "assistant",
"content": "SELECT strftime('%Y', hire_date) AS hire_year , count(lawyer_id) FROM legal_services.lawyers WHERE is_partner = true GROUP BY hire_... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"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": "What are the qualifications or training history of the staff member who performed the maintenance with record_id 'REC123'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about the qualifications or training history of staff members... | 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 for each fuel type the number of unique vehicle models available. Show the fuel_type and the model count."
},
{
"role": "assistant",
"content": "SELECT fuel_type, COUNT(DISTINCT model) AS model_count FROM transportation.vehicles GROUP BY fuel_type ORDER BY fuel... | You are an SQL statement expert. Given the table 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": "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 maintenance service records for vehicles that have successfully completed any trip."
},
{
"role": "assistant",
"content": "SELECT DISTINCT ml.* FROM transportation.maintenance_logs AS ml JOIN transportation.trips AS t ON ml.vehicle_id = t.vehicle_id WHERE t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "Find all token transfers where the value is greater than 1000, including the token name and symbol, along with the transaction details like from_address and gas_used."
},
{
"role": "assistant",
"content": "SELECT t.token_name, t.token_symbol, tr.from_address, tr.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.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"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": "How many group conversations are there?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.conversations WHERE is_group_chat = TRUE;"
}
] | You are an SQL statement expert. Given the table 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 text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... |
[
{
"role": "user",
"content": "Show me all reservations with their reservation_id, room_number, room status, and check_in_date."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id,\n rm.room_number,\n rm.status AS room_status,\n r.check_in_date\nFROM hospitality_techn... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room... |
[
{
"role": "user",
"content": "Show the first name, last name, and position of all staff members who are not currently active."
},
{
"role": "assistant",
"content": "SELECT first_name , last_name , position FROM hospitality_technology.staff WHERE is_active = false"
}
] | You are an SQL statement expert. Given the table 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": "Find the top 5 ERC20 tokens by number of approval events in `erc20_approval`. Show `contract_address`, `symbol`, and `total_approvals`."
},
{
"role": "assistant",
"content": "SELECT ea.contract_address,\n tm.symbol,\n COUNT(*) AS total_approvals\nFROM er... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List all insurance policies along with the product name and product type for each policy."
},
{
"role": "assistant",
"content": "SELECT p.policy_id, p.policy_number, p.start_date, p.end_date, p.premium_amount, ip.product_name, ip.product_type\nFROM insurance.policie... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "Find the most recent verified document for each application, showing application_id, document_id, and verification_timestamp."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.application_id, d.verification_timestamp\nFROM government_services.documents ... | You are an SQL statement expert. Given the table 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.documents ( document_id text PRIMARY KEY, application_id text, citizen_id text, document_type text,... |
[
{
"role": "user",
"content": "What is the average number of appointments assigned per employee for each job title?"
},
{
"role": "assistant",
"content": "SELECT e.job_title, CAST(COUNT(a.appointment_id) AS REAL) / COUNT(DISTINCT e.employee_id) AS average_appointments_per_employee FROM government... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego... |
[
{
"role": "user",
"content": "Show me the number of clients grouped by status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS client_count FROM legal_services.clients GROUP BY status;"
},
{
"role": "user",
"content": "Can you exclude statuses with fewer than 10 cli... | You are an SQL statement expert. Given the table 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": "Which games have achievements where the points value is exactly 0? List the game title and the achievement name."
},
{
"role": "assistant",
"content": "SELECT g.title AS game_title, a.name AS achievement_name\nFROM gaming_technology.achievements a\nJOIN gaming_techn... | You are an SQL statement expert. Given the table 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": "Can you narrow this down to only show cases where the case type is 'Criminal'?"
},
{
"role": "assistant",
"content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Crimin... | You are an SQL statement expert. Given the table 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": "Find employees who are managers and list the number of employees they directly manage. Show the manager's full name and the count of their direct reports."
},
{
"role": "assistant",
"content": "SELECT m.first_name || ' ' || m.last_name AS manager_full_name, COUNT(e.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "How many unread notifications are there with the type 'mention'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.notifications WHERE read_at IS NULL AND notification_type = 'mention';"
}
] | You are an SQL statement expert. Given the table 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 text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... |
[
{
"role": "user",
"content": "List the name and symbol for all assets that do not have a corresponding entry with the key 'website' in the metadata table."
},
{
"role": "assistant",
"content": "SELECT T1.name , T1.symbol FROM trading_platform.assets AS T1 LEFT JOIN trading_platform.metadata AS T... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "List document names and versions for documents that share the same case_id, showing each pair of versions."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "List the employee's first and last name along with the appointment ID and scheduled start time for all appointments associated with the citizen who has the national ID number 'A123456789'."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, a.ap... | You are an SQL statement expert. Given the table 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": "Retrieve all notifications sent in the last 24 hours, ordered by sent_at descending."
},
{
"role": "assistant",
"content": "SELECT *\nFROM government_services.notifications\nWHERE sent_at >= CURRENT_TIMESTAMP - INTERVAL '24 HOURS'\nORDER BY sent_at 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 government_services.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m... |
[
{
"role": "user",
"content": "For each document, show its document id, the verification status, and the purpose of the related appointment (if any)."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.verification_status, a.purpose\nFROM government_services.documents d\nLEFT JOIN gove... | You are an SQL statement expert. Given the table 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, -- unique identifier for the service
... |
[
{
"role": "user",
"content": "Provide a breakdown of the total number of conversations, showing how many are group chats and how many are not. Also, show the count of conversations that have a recorded last message time."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS total_conversatio... | You are an SQL statement expert. Given the table 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": "Show me all insurance plans where the website includes 'secure'."
},
{
"role": "assistant",
"content": "SELECT * FROM healthcare.insurance_plans WHERE website ILIKE '%secure%';"
}
] | You are an SQL statement expert. Given the table 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": "List all trips that were completed and experienced a significant delay in actual arrival compared to the scheduled arrival (more than 45 minutes)."
},
{
"role": "assistant",
"content": "SELECT\n trip_id,\n vehicle_id,\n driver_id,\n scheduled_arrival,\n actual_... | You are an SQL statement expert. Given the table 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": "我想查询某个飞机构建的所有检查记录,包括检查类型、检查结果、检查时间以及被检查的组件名称。"
},
{
"role": "assistant",
"content": "MATCH (ab:AircraftBuild)-[:UNDERWENT]->(i:Inspection)-[:INSPECTED_COMPONENT]->(c:Component)\nWHERE ab.build_id = 'specific_build_id'\nRETURN i.inspection_type, i.result, i.inspectio... | 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": "How many verified users are there?"
},
{
"role": "assistant",
"content": "SELECT COUNT(user_id) FROM social_media.users WHERE is_verified = TRUE;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and symbols, but only include collections with more than 10,000 tokens."
},
{
"role": "assistant",
"content": "SELECT name, symbol, floor_price FROM nft_collections WH... | You are an SQL statement expert. Given the table 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 guest, calculate their average total price per order, and show the number of orders they have placed."
},
{
"role": "assistant",
"content": "SELECT guest_id, AVG(total_price) AS avg_total_price, COUNT(*) AS order_count FROM hospitality_technology.service_or... | You are an SQL statement expert. Given the table 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.service_orders ( order_id text PRIMARY KEY, reservation_id text, guest_id text, service_id text,... |
[
{
"role": "user",
"content": "List pairs of distinct routes that originate from the same location but go to different destinations. Show the route ID and route number for both routes and the common origin location ID."
},
{
"role": "assistant",
"content": "SELECT\n r1.route_id AS route1_id,\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.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"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": "Could you show each in-game item's name, its rarity, and the total quantity acquired by all players?"
},
{
"role": "assistant",
"content": "SELECT i.item_name, i.rarity, SUM(pi.quantity) AS total_quantity\nFROM gaming_technology.in_game_items i\nJOIN 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.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date... |
[
{
"role": "user",
"content": "Show me all bookings with a status of 'confirmed' that were made in the last 7 days, including passenger_id and fare."
},
{
"role": "assistant",
"content": "SELECT booking_id, passenger_id, fare FROM transportation.bookings WHERE status = 'confirmed' AND booking_tim... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, passenger_id text, trip_id text, seat_number text, booking_time ... |
[
{
"role": "user",
"content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?"
},
{
"role": "assistant",
"content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.develo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "Can you help me retrieve the inventory details for a specific component ID, including the quantity and warehouse location?"
},
{
"role": "assistant",
"content": "HGETALL inv:<inventory_record_id>"
},
{
"role": "user",
"content": "Can you also include the... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Use Hashes. Key pattern: 'inv:<inventory_record_id>'. Example: HSET inv:INVREC500 component_id "c... |
[
{
"role": "user",
"content": "For each ERC20 token, how many unique wallets currently hold them? Show the contract address and unique wallet count."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(DISTINCT wallet_address) AS unique_wallet_count FROM erc20_balances GROUP 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": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count."
},
{
"role": "assistant",
"content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "How many messages in total have been sent that do not contain any media attachment?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS non_media_message_count\nFROM social_media.messages\nWHERE media_url IS NULL OR media_url = '';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.messages ( message_id text PRIMARY KEY, conversation_id text, sender_user_id text, content text, media_url... |
[
{
"role": "user",
"content": "What is the total investment_value per fundraising round for the year 2023? Order by total investment descending."
},
{
"role": "assistant",
"content": "SELECT\n substr(investment_date,1,7) AS month,\n rounds_name,\n SUM(investment_value) AS total_investment\nFRO... | You are an SQL statement expert. Given the table 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": "Which vehicles have a total maintenance cost exceeding 10000 across all their maintenance logs?"
},
{
"role": "assistant",
"content": "SELECT vehicle_id, SUM(cost) AS total_maintenance_cost FROM transportation.maintenance_logs GROUP BY vehicle_id HAVING SUM(cost) > ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "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": "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": "Show me all user IDs who changed their profile settings after June 1, 2024."
},
{
"role": "assistant",
"content": "SELECT user_id FROM social_media.user_settings WHERE updated_at > '2024-06-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.user_settings ( setting_id text PRIMARY KEY, user_id text, theme text, email_notifications_enabled bool, p... |
[
{
"role": "user",
"content": "List each guest’s full name and the total number of service orders they have placed, ordered by order count descending."
},
{
"role": "assistant",
"content": "SELECT g.guest_id,\n g.first_name || ' ' || g.last_name AS full_name,\n COUNT(so.order_id) AS 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.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "Show me all reservations made by guests from 'California' with their full name and the property name where they stayed. Include the reservation ID and check-in date."
},
{
"role": "assistant",
"content": "SELECT t1.reservation_id, t2.first_name, t2.last_name, t3.pro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "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": "I need a count of appointments per patient that took place between '2024-04-01' and '2024-04-30', showing patient_id, first_name, last_name, and the total number of appointments."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.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.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Can you show me the number of servers in each region, as well as the total max_players for each region?"
},
{
"role": "assistant",
"content": "SELECT region, COUNT(*) AS server_count, SUM(max_players) AS total_max_players FROM gaming_technology.servers GROUP BY regi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region text, ip_address text, port integer,... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 1