system stringlengths 333 7.66k | conversations listlengths 2 8 |
|---|---|
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 transportation.locations ( location_id.text, name.text, type.text, address_line1.tex... | [
{
"role": "user",
"content": "List pairs of distinct locations in the same city that share the same location type. Show both location IDs, names, city, and the shared type."
},
{
"role": "assistant",
"content": "SELECT L1.location_id AS location1_id, L1.name AS location1_name, L2.location_id AS ... |
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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, da... | [
{
"role": "user",
"content": "I need a report showing each security's ticker_symbol along with the total sum of trade total_amount and the count of trades executed in the last three months."
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, SUM(t.total_amount) AS total_trade_amount, ... |
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 gaming_technology.in_game_items ( item_id uuid, game_id uuid, item_name text, item_t... | [
{
"role": "user",
"content": "Can you show me the number of unique item types and the average cost amount for each game?"
},
{
"role": "assistant",
"content": "SELECT game_id, COUNT(DISTINCT item_type) AS unique_item_types, AVG(cost_amount) AS avg_cost_amount FROM gaming_technology.in_game_items... |
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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appo... | [
{
"role": "user",
"content": "Find overlapping appointments for each doctor. Return doctor_id, appointment_id_1, appointment_id_2, and overlap duration in minutes."
},
{
"role": "assistant",
"content": "SELECT a.doctor_id,\n a.appointment_id AS appointment_id_1,\n b.appointment_id AS... |
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "List the names of services and the total number of times each service has been ordered. Only include services that have been ordered at least once."
},
{
"role": "assistant",
"content": "SELECT T1.service_name, count(T2.order_id) AS order_count FROM hospitality_tech... |
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 legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique id... | [
{
"role": "user",
"content": "Show me a list of all partners who were hired in 2021."
},
{
"role": "assistant",
"content": "SELECT lawyer_id,\n first_name,\n last_name,\n hire_date\nFROM legal_services.lawyers\nWHERE is_partner = true\n AND hire_date BETWEEN '2021-01-01' AND '... |
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 healthcare.prescriptions (
prescription_id character varying(64) NOT NULL, -- un... | [
{
"role": "user",
"content": "Which doctors have issued prescriptions with a route of 'Oral'? Please show doctor_id and the number of such prescriptions they have written."
},
{
"role": "assistant",
"content": "SELECT doctor_id, COUNT(*) AS oral_prescription_count\nFROM healthcare.prescriptions\... |
You are an 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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_nam... | [
{
"role": "user",
"content": "Show me the top 3 tokens with the highest 7-day price change percentage. Display their symbol, chain, and 7d price change."
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, price_change_percentage_7d\nFROM token_basic_info\nORDER BY price_change_per... |
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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_i... | [
{
"role": "user",
"content": "For each policy, find the latest payment date. Show the policy_id and the maximum payment_date."
},
{
"role": "assistant",
"content": "SELECT policy_id, MAX(payment_date) AS latest_payment_date FROM insurance.premium_payments GROUP BY policy_id;"
},
{
"role"... |
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 social_media.user_settings ( setting_id text, user_id text, theme text, email_notifi... | [
{
"role": "user",
"content": "Show the user IDs of all users whose theme is set to 'blue'."
},
{
"role": "assistant",
"content": "SELECT user_id FROM social_media.user_settings WHERE theme = 'blue';"
}
] |
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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text... | [
{
"role": "user",
"content": "List all service orders showing the order ID, service ID, quantity, and total price."
},
{
"role": "assistant",
"content": "SELECT order_id, service_id, quantity, total_price FROM hospitality_technology.service_orders LIMIT 100;"
},
{
"role": "user",
"co... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,... | [
{
"role": "user",
"content": "For each SUI coin type, show the total balance across all owners and the number of distinct owners."
},
{
"role": "assistant",
"content": "SELECT\n coin_type,\n SUM(CAST(balance AS DECIMAL)) AS total_balance,\n COUNT(DISTINCT owner) AS owner_count\nFROM sui_coins... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,... | [
{
"role": "user",
"content": "Which ERC20 tokens have more than 8 decimals? Show their symbol, name, and decimals."
},
{
"role": "assistant",
"content": "SELECT symbol, name, decimals\nFROM token_metas\nWHERE is_erc20 = 1 AND decimals > 8;"
},
{
"role": "user",
"content": "Can you al... |
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "List the full name (first name and last name) and position of all staff members working at properties located in 'California'. Include the name of the property they work at."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.position, T2.p... |
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 web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_a... | [
{
"role": "user",
"content": "For each contract, list the contract address, the number of different tokens deployed on that address, and the sum of total_supply of those tokens."
},
{
"role": "assistant",
"content": "SELECT c.address AS contract_address, COUNT(DISTINCT t.token_id) AS token_count... |
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 gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id ... | [
{
"role": "user",
"content": "Can you provide a list of all players who have acquired at least one item, along with the item name, its type, and the title of the game that item belongs to?"
},
{
"role": "assistant",
"content": "SELECT pi.player_id, items.item_name, items.item_type, g.title AS ga... |
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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character... | [
{
"role": "user",
"content": "For each narrative, show its name and the total market cap of all related tokens based on DEX pool data."
},
{
"role": "assistant",
"content": "SELECT n.narrative, SUM(d.market_cap) AS total_market_cap\nFROM narrative_info n\nJOIN token_dexpool_info d ON n.top_3_coi... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text,... | [
{
"role": "user",
"content": "List all wallet addresses that hold SUI coins with a balance greater than 1,000,000. Please show the coin_type as well."
},
{
"role": "assistant",
"content": "SELECT owner, coin_type, balance\nFROM sui_coins\nWHERE CAST(balance AS DECIMAL) > 1000000;"
},
{
"... |
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 social_media.users ( user_id text, username text, email text, password_hash text, fu... | [
{
"role": "user",
"content": "Show me the usernames and email addresses of all users who are participants in conversations where user 'U333' has sent at least one message."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, u.email\nFROM social_media.conversation_participants cp\n... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, am... | [
{
"role": "user",
"content": "Find all wallets that hold at least one NFT and also hold ERC-20 tokens."
},
{
"role": "assistant",
"content": "SELECT DISTINCT nh.wallet_address\nFROM nft_holders nh\nJOIN erc20_balances eb\n ON nh.wallet_address = eb.wallet_address;"
},
{
"role": "user",
... |
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 gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, descr... | [
{
"role": "user",
"content": "Which players have unlocked any achievement?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT player_id FROM player_achievements;"
},
{
"role": "user",
"content": "Show me the player ID and the total number of points they've accumulated from all un... |
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 hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_nam... | [
{
"role": "user",
"content": "List all future reservations (where check_in_date > current_date) including guest full name, room_id, property_id, and the number of days until check-in."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, r.property_id, r.room_id, \n g.first_name ... |
You are an expert in writing database language and you can refuse the user's question if the question is not related to the table structure. 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
CREA... | [
{
"role": "user",
"content": "What is the current operational status of the train car with car_id 'CAR123'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the current operational status of the train car with car_id 'CAR123'. The data in the train_cars table ... |
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 web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address tex... | [
{
"role": "user",
"content": "For each recipient address, count how many token transfers they have received."
},
{
"role": "assistant",
"content": "SELECT to_address, COUNT(*) AS received_transfer_count FROM web3.token_transfers GROUP BY to_address;"
},
{
"role": "user",
"content": "... |
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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_i... | [
{
"role": "user",
"content": "Show the customer_id and pairs of payment_ids for any customers who have overlapping payment periods."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.payment_id AS payment1_id,\n p2.payment_id AS payment2_id\nFROM insurance.premium_pay... |
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 web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for... | [
{
"role": "user",
"content": "List each wallet that has received tokens of more than one distinct token type. Show wallet_id, address, the number of distinct tokens received as distinct_token_count, and the total received value, ordered by total_received_value descending."
},
{
"role": "assistant",
... |
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 hospitality_technology.reservations ( reservation_id text, property_id text, guest_i... | [
{
"role": "user",
"content": "Provide the monthly reservation count and total revenue for reservations made through 'Online Travel Agency' in 2023."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', check_in_date) AS month,\n COUNT(*) AS reservation_count,\n SUM(total_... |
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 gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -... | [
{
"role": "user",
"content": "List all in-game items' names, types, and rarity along with their total cost in USD, for items that belong to games released on or after 2021-01-01."
},
{
"role": "assistant",
"content": "SELECT i.item_name, i.item_type, i.rarity, i.cost_amount\nFROM gaming_technolo... |
You are an 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 hospitality_technology.services ( service_id.text, property_id.text, service_name.te... | [
{
"role": "user",
"content": "Can you show me the total number of available services and the average price for each department?"
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) AS available_service_count, AVG(price) AS average_price FROM hospitality_technology.services WHERE is... |
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 government_services.applications ( application_id text, citizen_id text, service_id ... | [
{
"role": "user",
"content": "List the reference_number and status for all applications assigned to employee 'emp200', along with the submitted_at date of each application."
},
{
"role": "assistant",
"content": "SELECT reference_number, status, submitted_at FROM government_services.applications ... |
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 transportation.fuel_logs (
fuel_log_id character varying(64) NOT NULL, -- uniqu... | [
{
"role": "user",
"content": "For each fueling event, show its fuel_log_id, vehicle_id, log_timestamp, and the previous fueling event's fuel_log_id, log_timestamp, and quantity for the same vehicle."
},
{
"role": "assistant",
"content": "SELECT fl.fuel_log_id,\n fl.vehicle_id,\n fl.l... |
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 web3.events ( event_id text, contract_id text, event_name text, data text, emitted_a... | [
{
"role": "user",
"content": "For each wallet, show the wallet address and the total value of tokens they have received across all token transfers."
},
{
"role": "assistant",
"content": "SELECT w.address, COALESCE(SUM(tt.value), 0) AS total_received_value\nFROM web3.wallets w\nLEFT JOIN web3.tok... |
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 social_media.likes (
like_id character varying(64) NOT NULL, -- unique identifie... | [
{
"role": "user",
"content": "Which users have received both a comment notification and a like notification? List the recipient_user_id and the total number of such users."
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT recipient_user_id) AS user_count\nFROM (\n SELECT recipient_us... |
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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character... | [
{
"role": "user",
"content": "List customers who have more than one policy. Show the customer ID and the count of policies."
},
{
"role": "assistant",
"content": "SELECT customer_id, COUNT(*) AS policy_count FROM insurance.policies GROUP BY customer_id HAVING COUNT(*) > 1;"
},
{
"role": ... |
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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash... | [
{
"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 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 insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, inci... | [
{
"role": "user",
"content": "List all active insurance products, including their product name, type, and base premium."
},
{
"role": "assistant",
"content": "SELECT product_name, product_type, base_premium FROM insurance.insurance_products WHERE is_active = TRUE;"
}
] |
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 healthcare.medications (
medication_id character varying(64) NOT NULL, -- unique... | [
{
"role": "user",
"content": "List the medication_id, medication_name, and description for all medications whose generic_name starts with 'A'."
},
{
"role": "assistant",
"content": "SELECT medication_id, medication_name, description\nFROM healthcare.medications\nWHERE generic_name LIKE 'A%';"
... |
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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_bir... | [
{
"role": "user",
"content": "List the first and last names, email, and phone number of all customers whose status is not 'Active'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, phone_number\nFROM insurance.customers\nWHERE status <> 'Active';"
},
{
"role": ... |
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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), usern... | [
{
"role": "user",
"content": "Show each player's username and the number of distinct games they have played sessions on."
},
{
"role": "assistant",
"content": "SELECT\n p.username,\n COUNT(DISTINCT gs.game_id) AS games_played\nFROM gaming_technology.players p\nJOIN gaming_technology.game_sessi... |
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "List all reservations along with the guest's full name and the property name for reservations made in properties outside the USA."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS guest_full_name, p.property_name\n... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, ser... | [
{
"role": "user",
"content": "Show all in-game items (name, rarity) that belong to games where the average session score across all sessions for that game is greater than 300."
},
{
"role": "assistant",
"content": "SELECT ii.item_name, ii.rarity FROM gaming_technology.in_game_items AS ii WHERE i... |
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop... | [
{
"role": "user",
"content": "Show me all service orders with their order ID, guest ID, reservation ID, and the name of the property where the order was made."
},
{
"role": "assistant",
"content": "SELECT so.order_id, so.guest_id, so.reservation_id, p.property_name\nFROM hospitality_technology.s... |
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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transacti... | [
{
"role": "user",
"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": "assistant",
"content": "SELECT contract_address, wallet_address, COUNT(DISTINC... |
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 legal_services.clients (
client_id character varying(64) NOT NULL, -- unique id... | [
{
"role": "user",
"content": "List all documents uploaded for cases handled in the 'District Court' jurisdiction, showing the document name, case number, and upload timestamp."
},
{
"role": "assistant",
"content": "SELECT d.document_name, cs.case_number, d.upload_timestamp\nFROM legal_services.d... |
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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text... | [
{
"role": "user",
"content": "Display each product alongside the most recently updated product of the same type. Return original_id, original_updated_at, recent_id, recent_updated_at, and product_type."
},
{
"role": "assistant",
"content": "SELECT p.product_id AS original_id, p.updated_at AS ori... |
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 social_media.likes (
like_id character varying(64) NOT NULL, -- unique identifie... | [
{
"role": "user",
"content": "How many notifications have been marked as read so far?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS read_notifications_count\nFROM social_media.notifications\nWHERE read_at IS NOT NULL;"
}
] |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,... | [
{
"role": "user",
"content": "Show me the total amount held and number of unique wallets for each ERC20 token with a symbol ending in 'X'."
},
{
"role": "assistant",
"content": "SELECT tm.symbol, SUM(CAST(ebh.amount AS DECIMAL)) AS total_amount, COUNT(DISTINCT ebh.wallet_address) AS unique_walle... |
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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text... | [
{
"role": "user",
"content": "List all cases where the client and the lead lawyer belong to companies or law firms with the same phone number. For each such case, please show the case name, client name, client company, lead lawyer name, and the shared phone number."
},
{
"role": "assistant",
"co... |
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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character... | [
{
"role": "user",
"content": "List customers who have both a canceled policy and an active policy. Show customer_id, canceled_policy_id, and active_policy_id."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_id AS canceled_policy_id,\n p2.policy_id AS active_... |
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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character... | [
{
"role": "user",
"content": "For each customer, find pairs of policies where one policy’s premium is at least $5000 higher than the other. Show customer_id, lower_premium_policy_id, higher_premium_policy_id, and the premium_difference."
},
{
"role": "assistant",
"content": "SELECT p1.customer_i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.