conversations listlengths 2 8 | system stringlengths 288 8.03k |
|---|---|
[
{
"content": "How many 'ApprovalForAll' events are recorded for each ERC1155 contract address in the `erc1155_approval_for_all` table?",
"role": "user"
},
{
"content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_address;",
"role": "assista... | You are an SQL statement expert. Given the table 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 ... |
[
{
"content": "Count how many posts have media attachments.",
"role": "user"
},
{
"content": "SELECT count(*) FROM social_media.posts WHERE media_url IS NOT NULL",
"role": "assistant"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?",
"role": "user"
},
{
"content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.developer_id AS next_dev,\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 gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"content": "I need to know the total USD value of all ERC-20 holdings by each wallet. Calculate the sum of (amount * price) using the latest token prices from token_prices_latest, grouped by wallet_address.",
"role": "user"
},
{
"content": "SELECT eb.wallet_address,\n SUM(CAST(eb.amount AS 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 erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text )
CREATE TABLE n... |
[
{
"content": "For each patient, show their full name and the count of insurance plans they are enrolled in, as well as their earliest policy effective date.",
"role": "user"
},
{
"content": "SELECT p.first_name, p.last_name, COUNT(pi.plan_id) AS plan_count, MIN(pi.effective_date) AS earliest_effecti... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"content": "Can you list all group conversations and the number of participants in each?",
"role": "user"
},
{
"content": "SELECT c.conversation_id, c.group_name, COUNT(cp.user_id) AS participant_count\nFROM social_media.conversations c\nJOIN social_media.conversation_participants cp ON c.conversa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"content": "Show me the total billable hours per lawyer from the time_entries table.",
"role": "user"
},
{
"content": "SELECT lawyer_id, SUM(hours_spent) AS total_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\nGROUP BY lawyer_id;",
"role": "assistant"
},
{
"content"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"content": "For each driver, show their driver_id, first_name, last_name, along with any other driver whose license_expiry_date is earlier than theirs.",
"role": "user"
},
{
"content": "SELECT d1.driver_id AS driver_id,\n d1.first_name,\n d1.last_name,\n d2.driver_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... |
[
{
"content": "Show me the total USD value of tokens held by each centralized exchange on the 'Polygon' chain for the most recent snapshot time. List the exchange name and the total USD value.",
"role": "user"
},
{
"content": "WITH LatestSnapshot AS ( SELECT MAX(snapshot_time) as latest_time FROM cex... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Which wallets hold at least 100 units of any ERC1155 NFT, and what is the token ID and contract address of the NFT for each such holding?",
"role": "user"
},
{
"content": "SELECT wallet_address, contract_address, token_id, amount\nFROM nft_holders\nWHERE contract_type = 'ERC1155' AND 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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"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": "user"
},
{
"content": "SELECT conversation_id, group_name, created_at, LEAD(created_at) OVER (ORDER BY created_at) AS next_group_ch... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Show me all users who have commented on a post and have also liked any comment on that same post. I want their user IDs and the corresponding post IDs.",
"role": "user"
},
{
"content": "SELECT DISTINCT c.user_id, c.post_id\nFROM social_media.comments c\nJOIN social_media.likes l ON l.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 social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"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": "user"
},
{
"content": "WITH latest_appt AS (\n SELECT patient_id, MAX(appointment... | You are an SQL statement expert. Given the table 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, ... |
[
{
"content": "What is the average number of wallets each user owns?",
"role": "user"
},
{
"content": "SELECT\n AVG(wallet_count) AS avg_wallets_per_user\nFROM (\n SELECT user_id, COUNT(*) AS wallet_count\n FROM web3.wallets\n GROUP BY user_id\n) AS sub;",
"role": "assistant"
},
{
"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 web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"content": "Show me all wallet addresses that hold more than 3 different NFTs from any ERC1155 contract. For each wallet, list the contract address and the count of distinct token_ids.",
"role": "user"
},
{
"content": "SELECT contract_address, wallet_address, COUNT(DISTINCT token_id) AS token_id_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, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"content": "I need to list the top 5 ERC20 tokens by total supply, including symbol, contract_address, and name.",
"role": "user"
},
{
"content": "SELECT tm.contract_address, tm.symbol, tm.name, CAST(tm.total_supply AS DECIMAL) AS total_supply\nFROM token_metas tm\nWHERE tm.is_erc20 = 1\nORDER BY ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"content": "For each user, show their username and the timestamp of their most recent notification. Include users who have never received notifications.",
"role": "user"
},
{
"content": "SELECT T1.username, max(T2.sent_at) FROM users AS T1 LEFT JOIN trading_platform.notifications AS T2 ON T1.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 trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"content": "How many lawyers who are partners were hired in each year? Show the hire year and the count.",
"role": "user"
},
{
"content": "SELECT strftime('%Y', hire_date) AS hire_year , count(lawyer_id) FROM legal_services.lawyers WHERE is_partner = true GROUP BY hire_year",
"role": "assis... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Provide a count of notifications, separated by whether they have been read or not.",
"role": "user"
},
{
"content": "SELECT CASE WHEN T1.read_at IS NULL THEN 'Unread' ELSE 'Read' END, count(T1.notification_id) FROM trading_platform.notifications AS T1 GROUP BY CASE WHEN T1.read_at IS N... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"content": "List patients who have appointments scheduled, their appointment time, the name of their primary insurance plan, and the provider name.",
"role": "user"
},
{
"content": "SELECT p.first_name AS patient_first_name, p.last_name AS patient_last_name, a.appointment_time, ip.plan_name, ip.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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"content": "Find all wallets that were created on the same day and list their wallet IDs, addresses, and the creation date.",
"role": "user"
},
{
"content": "SELECT w1.wallet_id, w1.address, w1.created_at::date AS creation_date FROM web3.wallets w1 JOIN (SELECT created_at::date AS creation_date FR... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "List the first name, last name, prescription ID, diagnosis code, and diagnosis description for patients who have both an ongoing prescription and an active chronic diagnosis.",
"role": "user"
},
{
"content": "SELECT DISTINCT T1.first_name, T1.last_name, T2.prescription_id, T3.diagnosis... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "What are the qualifications or training history of the staff member who performed the maintenance with record_id 'REC123'?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide information about the qualifications or training history of staff members as this data is not stor... | 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... |
[
{
"content": "I need to get the inventory quantity and location for a specific batch number. Can you help with that?",
"role": "user"
},
{
"content": "HGETALL inv:<inventory_record_id>",
"role": "assistant"
},
{
"content": "Can you also show me the component ID associated with this batch... | 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... |
[
{
"content": "For each category, list all pairs of services where one is active and the other is inactive. Show the category, active service name, and inactive service name.",
"role": "user"
},
{
"content": "SELECT a.category,\n a.service_name AS active_service,\n i.service_name AS inact... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "List all group chats and the total count of messages sent in each one.",
"role": "user"
},
{
"content": "SELECT T1.group_name, count(T2.message_id) AS message_count FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.conversation_id = T2.conversation_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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"content": "Count the total number of comments each user has made.",
"role": "user"
},
{
"content": "SELECT user_id, COUNT(*) AS comment_count FROM comments GROUP BY user_id;",
"role": "assistant"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t... |
[
{
"content": "Show me the number of game servers in each region and the average maximum number of players they can accommodate. Exclude any servers that are currently offline.",
"role": "user"
},
{
"content": "SELECT region, COUNT(server_id) AS server_count, AVG(max_players) AS average_max_players 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 gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"content": "For each vehicle that has both maintenance and fuel log records, show the vehicle_id, make, model, count of maintenance_logs as maintenance_count, and count of fuel_logs as fuel_count.",
"role": "user"
},
{
"content": "SELECT v.vehicle_id, v.make, v.model,\n COUNT(DISTINCT m.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 transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"content": "Show me all claims with police reports that were filed in the last 3 months, along with their policy details and estimated loss amounts.",
"role": "user"
},
{
"content": "SELECT cl.claim_id, cl.policy_id, cl.estimated_loss, cl.incident_date, cl.reported_date, p.premium_amount, p.covera... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Show me all ERC20 token transfers where the amount is over 5000, including the sender and receiver addresses.",
"role": "user"
},
{
"content": "SELECT from_address, to_address, amt, tick, tx_hash FROM token_activities WHERE type = 'transfer' AND CAST(amt AS DECIMAL) > 5000;",
"role... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar )
CR... |
[
{
"content": "For each route that originates from a location of type 'Port', list the route number, the name of the origin location, and the total distance accumulated from all completed trips on this route.",
"role": "user"
},
{
"content": "SELECT\n r.route_number,\n l_origin.name AS origin_locat... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "What are the training programs or certifications completed by a staff member with the role of Platform Supervisor?",
"role": "user"
},
{
"content": "I'm sorry, but I don't have access to information about the training programs or certifications completed by staff members. The data avai... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.s... |
[
{
"content": "For each game, count how many achievements it has and calculate the average points.",
"role": "user"
},
{
"content": "SELECT game_id,\n COUNT(*) AS total_achievements,\n AVG(points) AS avg_points\nFROM achievements\nGROUP BY game_id;",
"role": "assistant"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url t... |
[
{
"content": "List all users whose usernames start with the letter 'B'.",
"role": "user"
},
{
"content": "SELECT user_id, username, email, created_at FROM trading_platform.users WHERE username LIKE 'B%';",
"role": "assistant"
},
{
"content": "Can you make it case-insensitive, so username... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Find transactions that triggered events and whose to_address matches the contract_id of the emitted event. List the transaction ID, the to_address, and the count of such events for that transaction.",
"role": "user"
},
{
"content": "SELECT t.transaction_id, t.to_address, COUNT(e.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, -- unique identifier for the event
contract_id characte... |
[
{
"content": "Show me all insurance plans that have more than 5 patients enrolled, along with the provider name and count of patients, sorted by patient count in descending order.",
"role": "user"
},
{
"content": "SELECT i.plan_name, i.insurance_provider, COUNT(p.patient_id) AS patient_count FROM he... | You are an SQL statement expert. Given the table 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, ... |
[
{
"content": "List all clients along with their case_number and case_type for cases that are currently 'Open'.",
"role": "user"
},
{
"content": "SELECT c.first_name, c.last_name, c.email, cs.case_number, cs.case_type\nFROM legal_services.clients AS c\nJOIN legal_services.cases AS cs\n ON c.client_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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and belong to the 'Healthcare' sector, along with their last_updated timestamp.",
"role": "user"
},
{
"content": "SELECT security_id, ticker_symbol, security_name, last_updated FROM 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 financial_services.securities ( security_id character varying(64) NOT NULL, ticker_symbol character varying(20) NOT NUL... |
[
{
"content": "List all comments that have at least one like, showing comment_id, content, and like_count.",
"role": "user"
},
{
"content": "SELECT c.comment_id, c.content, COUNT(l.like_id) AS like_count\nFROM social_media.comments c\nJOIN social_media.likes l ON c.comment_id = l.comment_id\nGROUP BY... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"content": "List all services with an average processing time greater than the overall average processing time for all services. Show the service name, average processing time, and the overall average processing time.",
"role": "user"
},
{
"content": "SELECT service_name, average_processing_time_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 government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser... |
[
{
"content": "Show all peers whose last_seen timestamp is before '2023-01-01' and whose port number is less than 1000, listing their peer_id and ip_address.",
"role": "user"
},
{
"content": "SELECT peer_id, ip_address FROM trading_platform.peers WHERE last_seen < '2023-01-01' AND port < 1000;",
... | You are an SQL statement expert. Given the table 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.peers ( peer_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port intege... |
[
{
"content": "For each doctor, count the number of chronic diagnoses they have made. Show the doctor's full name and the count.",
"role": "user"
},
{
"content": "SELECT doc.first_name, doc.last_name, COUNT(d.diagnosis_id) FROM healthcare.doctors doc JOIN healthcare.diagnoses d ON doc.doctor_id = d.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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"content": "Find all pairs of achievement unlocks and item acquisitions by the same player where the item was acquired after the achievement was unlocked. List player_id, achievement_id, unlocked_at, item_id, and acquired_at.",
"role": "user"
},
{
"content": "SELECT pa.player_id, pa.achievement_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.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points.... |
[
{
"content": "Show me each guest's full name and the number of unique properties they have made reservations for.",
"role": "user"
},
{
"content": "SELECT g.first_name || ' ' || g.last_name AS full_name,\n COUNT(DISTINCT r.property_id) AS property_count\nFROM hospitality_technology.guests g\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.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"content": "List the medication_name and manufacturer for all medications where the description is null or an empty string.",
"role": "user"
},
{
"content": "SELECT medication_name, manufacturer FROM healthcare.medications WHERE description IS NULL OR description = '';",
"role": "assistant"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"content": "List all wallets that were created during the hour of the day which saw the highest number of wallet creations. Show the wallet ID, user ID, address, and creation timestamp.",
"role": "user"
},
{
"content": "WITH HourlyCounts AS (\n SELECT EXTRACT(HOUR FROM created_at) AS hour, COUN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"content": "What is the ticket price for a journey on train number T4321?",
"role": "user"
},
{
"content": "I'm sorry, but I don't have access to information about ticket prices for specific trains. The data I have is limited to train details such as model, manufacturer, capacity, and maintenance ... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.t... |
[
{
"content": "Show me all invoices for cases with status 'Closed'.",
"role": "user"
},
{
"content": "SELECT T1.* FROM legal_services.invoices AS T1 JOIN legal_services.cases AS T2 ON T1.case_id = T2.case_id WHERE T2.status = 'Closed';",
"role": "assistant"
},
{
"content": "Only include 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 legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t... |
[
{
"content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts, and show their network IDs and deployment timestamps.",
"role": "user"
},
{
"content": "SELECT address, network_id, deployed_at FROM web3.contracts WHERE address = dep... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"content": "Show me all premium payments made via credit card in the last 30 days, along with their policy IDs and payment amounts.",
"role": "user"
},
{
"content": "SELECT payment_id, policy_id, amount_paid, payment_date FROM insurance.premium_payments WHERE payment_method = 'Credit Card' AND pay... | You are an SQL statement expert. Given the table 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 ... |
[
{
"content": "Generate a summary for each account showing the total commissions from trades and total fees from completed transactions in April 2024.",
"role": "user"
},
{
"content": "SELECT t.account_id,\n SUM(COALESCE(t.commission,0)) AS total_trade_commission,\n SUM(CASE WHEN tr.trans... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
... |
[
{
"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": "user"
},
{
"content": "SELECT\n e.event_id,\n e.event_name,\n tt.transfer_id,\n tk.token_symbol\nFROM web3.events e\nLEFT JOIN 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... |
[
{
"content": "Show the total number of customers in each state.",
"role": "user"
},
{
"content": "SELECT\n state,\n COUNT(customer_id)\nFROM insurance.customers\nGROUP BY\n state;",
"role": "assistant"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 18