system stringlengths 288 8.23k | conversations listlengths 2 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.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... | [
{
"role": "user",
"content": "Find all pairs of drivers where one driver's license_expiry_date is earlier than another's. Return each pair's driver_ids, full names, and respective expiry dates."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id, d1.first_name || ' ' || d1.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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... | [
{
"role": "user",
"content": "I would like to calculate the average rarity_score for each NFT collection on the Ethereum blockchain."
},
{
"role": "assistant",
"content": "SELECT c.contract_address,\n AVG(m.rarity_score) AS avg_rarity\nFROM nft_collections c\nJOIN nft_metadata m\n ON c.co... |
You are an SQL statement expert. Given the table 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": "List all time entries, showing the date worked, hours spent, description, the first and last name of the lawyer, and the name of the case."
},
{
"role": "assistant",
"content": "SELECT T1.date_worked, T1.hours_spent, T1.description, T2.first_name, T2.last_name, T3.c... |
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 smart_money_profit ( address character varying(100) NOT NULL, rank INT, profit numer... | [
{
"role": "user",
"content": "List smart money addresses, their chain, and profit for those who have incurred a loss. Order the results by the magnitude of the loss (smallest profit value first)."
},
{
"role": "assistant",
"content": "SELECT address, chain, profit FROM smart_money_profit WHERE 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 social_media.follows ( follow_id.text, follower_user_id.text, following_user_id.text, created_at.timestamp )
| [
{
"role": "user",
"content": "Show me all users who started following someone in May 2024, along with both the user ID of the follower and the followed user."
},
{
"role": "assistant",
"content": "SELECT follower_user_id, following_user_id\nFROM social_media.follows\nWHERE created_at >= '2024-05... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N... | [
{
"role": "user",
"content": "Generate a report showing the total number of achievement unlocks broken down by the calendar day they occurred. Show the date and the total number of unlocks for that day."
},
{
"role": "assistant",
"content": "SELECT DATE(unlocked_at) AS unlock_date, COUNT(player_... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id.text, created_at.timestamp, last_message_at.timestamp, is_group_chat.boole... | [
{
"role": "user",
"content": "List all users with private profiles who have disabled push notifications, including their user_id and email_notifications_enabled status."
},
{
"role": "assistant",
"content": "SELECT user_id,\n email_notifications_enabled\nFROM social_media.user_settings\nWH... |
You are an SQL statement expert. Given the table 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.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... | [
{
"role": "user",
"content": "For each game, which server has hosted the most sessions?"
},
{
"role": "assistant",
"content": "SELECT game_id, server_id, COUNT(*) AS session_count FROM gaming_technology.game_sessions GROUP BY game_id, server_id;"
},
{
"role": "user",
"content": "I wa... |
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address_id chara... | [
{
"role": "user",
"content": "I want to find all pairs of wallets that belong to the same user."
},
{
"role": "assistant",
"content": "SELECT w1.wallet_id AS wallet1, w2.wallet_id AS wallet2, w1.user_id\nFROM blockchain.wallets w1\nJOIN blockchain.wallets w2\n ON w1.user_id = w2.user_id\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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... | [
{
"role": "user",
"content": "Show all tokens on the Ethereum chain in token_dexpool_info that had a price increase in the last 6 hours, along with their 24h trading volume and smart money ROI."
},
{
"role": "assistant",
"content": "SELECT td.token_symbol,\n td.price_change_percentage_6h,\... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, trip_... | [
{
"role": "user",
"content": "Find all pairs of fuel log entries for the same vehicle that occurred on the same calendar day. Show vehicle ID, the two log IDs, and their timestamps."
},
{
"role": "assistant",
"content": "SELECT\n f1.vehicle_id,\n f1.fuel_log_id AS log_id_1,\n f2.fuel_lo... |
You are an SQL statement expert. Given the table 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 PRIMARY KEY, from_address text, to_address text, value numeric, gas_used int, g... | [
{
"role": "user",
"content": "Find transactions where the from_address is the same as the to_address (self-transactions) with values greater than 1 ETH (1e18 wei), showing transaction_id and value."
},
{
"role": "assistant",
"content": "SELECT transaction_id, value FROM web3.transactions WHERE f... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative character varying(512) NOT NULL, -- the id of narrative top_3_coins text, -- the top 3 token... | [
{
"role": "user",
"content": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their chain information."
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, usd_value FROM smart_money_token_inflow WHERE type = 1 ORDER BY usd_value DES... |
You are an SQL statement expert. Given the table 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": "List the date worked, hours spent, and description for all time entries that have not yet been billed."
},
{
"role": "assistant",
"content": "SELECT date_worked , hours_spent , description FROM time_entries WHERE is_billed = false"
},
{
"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 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": "Provide a count of cases for each case type."
},
{
"role": "assistant",
"content": "SELECT case_type, count(*) FROM legal_services.cases GROUP BY case_type"
},
{
"role": "user",
"content": "Only include counts for 'Civil Litigation' and 'Criminal Defense... |
You are an SQL statement expert. Given the table 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.nodes ( node_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port integer NOT ... | [
{
"role": "user",
"content": "List each port along with the count of distinct IP addresses observed on that port."
},
{
"role": "assistant",
"content": "SELECT port, COUNT(DISTINCT ip_address) AS unique_ip_count FROM blockchain.nodes GROUP BY port;"
},
{
"role": "user",
"content": "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 legal_services.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t... | [
{
"role": "user",
"content": "For each case type, calculate the average time to close cases in days, only including cases that have been closed."
},
{
"role": "assistant",
"content": "SELECT case_type,\n AVG(EXTRACT(EPOCH FROM (date_closed - date_opened)) / 86400) AS avg_close_days\nFROM 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 insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... | [
{
"role": "user",
"content": "Show me all customers who have missing contact information (either phone number or email is null), along with their state and city."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone_number IS NULL O... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... | [
{
"role": "user",
"content": "List all appointments scheduled in the next 30 days with appointment_id, client_id, case_id, and any invoice_id linked to that case."
},
{
"role": "assistant",
"content": "SELECT\n a.appointment_id,\n a.client_id,\n a.case_id,\n i.invoice_id\nFROM legal_services... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_... | [
{
"role": "user",
"content": "I need to get the total trading volume for each asset along with the asset name."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, SUM(t.quantity * t.price) AS total_volume\nFROM trading_platform.trades t\nJOIN trading_platform.assets a ON t.asset_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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... | [
{
"role": "user",
"content": "Show me all drivers who have completed more than 10 trips in the last month, along with their contact information and the average passenger count for their trips."
},
{
"role": "assistant",
"content": "SELECT d.driver_id, d.first_name, d.last_name, d.contact_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 transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... | [
{
"role": "user",
"content": "List all vehicles that have no associated fuel logs. Include the vehicle's make, model, and license plate."
},
{
"role": "assistant",
"content": "SELECT T1.make , T1.model , T1.license_plate FROM transportation.vehicles AS T1 LEFT JOIN transportation.fuel_logs 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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... | [
{
"role": "user",
"content": "Count the number of users whose location is 'London'."
},
{
"role": "assistant",
"content": "SELECT count(*) FROM social_media.users WHERE location = 'London';"
}
] |
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti... | [
{
"role": "user",
"content": "For each passenger, show their full name, email, and the number of unique trips they have participated in."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, p.email, COUNT(DISTINCT b.trip_id) AS unique_trips\nFROM transportation.passengers p\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 token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... | [
{
"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 web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... | [
{
"role": "user",
"content": "List all token symbols and their total supply for tokens where the total supply is greater than the average total supply of all tokens."
},
{
"role": "assistant",
"content": "SELECT token_symbol, total_supply FROM web3.tokens WHERE total_supply > (SELECT AVG(total_s... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... | [
{
"role": "user",
"content": "List all policies that expired in the last 30 days, along with their product IDs and premium amounts."
},
{
"role": "assistant",
"content": "SELECT policy_id, product_id, premium_amount FROM insurance.policies WHERE end_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 3... |
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 smart_money_token_inflow ( token_address text, token_symbol text, token_amount numer... | [
{
"role": "user",
"content": "What is the total USD value of smart money token inflows for each chain?"
},
{
"role": "assistant",
"content": "SELECT chain, SUM(usd_value) AS total_usd_inflow FROM smart_money_token_inflow GROUP BY chain ORDER BY total_usd_inflow DESC;"
},
{
"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 government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... | [
{
"role": "user",
"content": "List all pairs of active services in the same category where one service’s standard fee is higher than the other’s. Display the category, the higher-fee service name with its fee, and the lower-fee service name with its fee."
},
{
"role": "assistant",
"content": "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 insurance.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... | [
{
"role": "user",
"content": "Identify agents who have sold overlapping policies. Return agent_id, policy_number1, policy_number2, and their coverage dates."
},
{
"role": "assistant",
"content": "SELECT p1.agent_id,\n p1.policy_number AS policy_number1,\n p2.policy_number AS policy_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.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... | [
{
"role": "user",
"content": "Show conversations that are group chats and have more than 5 participants. List the conversation_id and group_name."
},
{
"role": "assistant",
"content": "SELECT c.conversation_id, c.group_name FROM social_media.conversations AS c JOIN social_media.conversation_part... |
You are an SQL statement expert. Given the table 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": "Retrieve all applications that have no assigned employee. Display the application_id, citizen_id, service_id, submitted_at, and status."
},
{
"role": "assistant",
"content": "SELECT\n application_id,\n citizen_id,\n service_id,\n submitted_at,\n status\nFROM go... |
You are an SQL statement expert. Given the table 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 all active agents who have handled claims with police reports, along with the count of such claims per agent."
},
{
"role": "assistant",
"content": "SELECT a.agent_id, a.first_name, a.last_name, COUNT(c.claim_id) as police_report_claims FROM insurance.agents... |
You are an SQL statement expert. Given the table 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": "Calculate the average market cap and average 24-hour trading volume for tokens belonging to each narrative category."
},
{
"role": "assistant",
"content": "SELECT narrative, AVG(market_cap) AS average_market_cap, AVG(CAST(REPLACE(total_volume, ',', '') AS NUMERIC)) ... |
You are an SQL statement expert. Given the table 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": "For each maintenance log, list the vehicle's license plate, the name of the mechanic, and the service date, ordered by most recent service first."
},
{
"role": "assistant",
"content": "SELECT ml.log_id, v.license_plate, ml.mechanic_name, ml.service_date\nFROM transp... |
You are an SQL statement expert. Given the table 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 pairs of customers who live in the same city. Return both customer IDs, their full names, and the city."
},
{
"role": "assistant",
"content": "SELECT c1.customer_id AS customer1_id, c1.first_name || ' ' || c1.last_name AS customer1_name, c2.customer_id AS custo... |
You are an SQL statement expert. Given the table 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 pairs of drivers who share the same hire_date, showing both driver IDs, first and last names, and the hire_date."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id,\n d1.first_name AS driver1_first_name,\n d1.last_name AS d... |
You are an SQL statement expert. Given the table 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, -- unique identifier for the client
first_n... | [
{
"role": "user",
"content": "List all documents with their document_name, document_type, the name of the associated case, and the first and last name of the client who owns the case."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.document_name, d.document_type, c.case_name, cl.f... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price... | [
{
"role": "user",
"content": "List all failed transactions where the gas_used is greater than 100,000, including the transaction_id and timestamp."
},
{
"role": "assistant",
"content": "SELECT transaction_id, timestamp FROM web3.transactions WHERE status = 'failed' AND gas_used > 100000;"
},
... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... | [
{
"role": "user",
"content": "Find all blocks that contain transactions where the amount is greater than 500, and include the block difficulty."
},
{
"role": "assistant",
"content": "SELECT DISTINCT b.block_id, b.difficulty FROM blockchain.blocks b JOIN blockchain.transactions t ON b.block_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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... | [
{
"role": "user",
"content": "Which servers are currently 'online' and located in the 'us-west-2' region, and what is the title of the game each server is hosting?"
},
{
"role": "assistant",
"content": "SELECT s.server_id, s.server_name, s.region, g.title AS game_title\nFROM gaming_technology.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 web3.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
| [
{
"role": "user",
"content": "Show me all users whose username contains 'dev', including their user_id and email address."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email FROM web3.users WHERE username ILIKE '%dev%';"
},
{
"role": "user",
"content": "Can you als... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... | [
{
"role": "user",
"content": "List each branch_id, the number of employees in that branch, and the number of securities that trade on that branch's exchange."
},
{
"role": "assistant",
"content": "SELECT e.branch_id,\n COUNT(DISTINCT e.employee_id) AS employee_count,\n COUNT(s.securi... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ... | [
{
"role": "user",
"content": "Show me all room types with a base rate over $200 and max occupancy of at least 4, along with their property IDs and amenities."
},
{
"role": "assistant",
"content": "SELECT rt.room_type_id, rt.property_id, rt.type_name, rt.base_rate, rt.max_occupancy, rt.amenities ... |
You are an SQL statement expert. Given the table 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 PRIMARY KEY, game_id uuid, name text, description text, icon_url t... | [
{
"role": "user",
"content": "How many hidden achievements are there?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM gaming_technology.achievements WHERE hidden = true;"
},
{
"role": "user",
"content": "Also, what is the average point value of all achievements that are 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 web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
| [
{
"role": "user",
"content": "Find all pairs of users where the registration times are within 30 minutes of each other, and show both user IDs, usernames, and the time difference in minutes."
},
{
"role": "assistant",
"content": "SELECT u1.user_id AS user1_id, u1.username AS user1_name, u2.user_... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... | [
{
"role": "user",
"content": "I need to find patients who received prescriptions within 7 days after their latest appointment. Show patient_id, first and last name, appointment_time, prescription_date, and medication_name."
},
{
"role": "assistant",
"content": "WITH latest_appt AS (\n SELECT 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 hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... | [
{
"role": "user",
"content": "List payment records in USD including guest names and processing staff names."
},
{
"role": "assistant",
"content": "SELECT p.payment_id,\n p.amount,\n p.currency_code,\n g.guest_name,\n s.staff_name\nFROM hospitality_technology.payments p\nJ... |
You are an SQL statement expert. Given the table 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": "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.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ... | [
{
"role": "user",
"content": "Find pairs of reservations at the same property where the second check-in is within 7 days after the first check-out. Return first_reservation, second_reservation, and gap_days."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id AS first_reservation,\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.