conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Find all policies that were cancelled due to 'Non-payment'. Show the policy number, cancellation date, and premium amount for these policies."
},
{
"role": "assistant",
"content": "SELECT policy_number , cancellation_date , premium_amount FROM insurance.policies W... | 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": "Show me the top 3 narratives by trend rank, along with their top 3 tokens and 7-day price change percentage."
},
{
"role": "assistant",
"content": "SELECT ni.narrative, ni.top_3_coins, ni.price_change_percentage_7d FROM narrative_info ni ORDER BY ni.trend_rank ASC L... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "What proportion of posts have received at least one like? Return the ratio as a decimal between 0 and 1."
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT CASE WHEN l.post_id IS NOT NULL THEN p.post_id END)::float / COUNT(DISTINCT p.post_id) AS like_ratio... | 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 the transfer id, token symbol, and the total supply of the token for every token transfer, but only for transfers where the transferred value is less than 100. Order by transfer_id."
},
{
"role": "assistant",
"content": "SELECT tt.transfer_id, tk.token_symbol, ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Count the total number of followers each user has, showing following_user_id as user_id and follower_count, for those users with more than 100 followers."
},
{
"role": "assistant",
"content": "SELECT following_user_id AS user_id, COUNT(*) AS follower_count\nFROM soc... | 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 text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "Get the total balance of each SUI coin per coin_type, including symbol and name from metadata."
},
{
"role": "assistant",
"content": "SELECT sc.coin_type,\n scm.symbol,\n scm.name,\n SUM(CAST(sc.balance AS NUMERIC)) AS total_balance\nFROM sui_coins... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "List each guest’s full name and the total number of service orders they have placed, ordered by order count descending."
},
{
"role": "assistant",
"content": "SELECT g.guest_id,\n g.first_name || ' ' || g.last_name AS full_name,\n COUNT(so.order_id) AS o... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "Identify all sender addresses that have transferred tokens in more than 3 distinct transactions. Return from_address and transfer_count, ordered by transfer_count descending."
},
{
"role": "assistant",
"content": "SELECT\n from_address,\n COUNT(DISTINCT transactio... | 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 character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add... |
[
{
"role": "user",
"content": "Can you provide the total number of cars associated with a specific train with train_id 'train_789'?"
},
{
"role": "assistant",
"content": "SCARD train:train_789:cars"
}
] | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for platform details. Key format: platform:<platform_id>
// HSET platform:plat_123 ... |
[
{
"role": "user",
"content": "List all applications that have at least one document with a verification status of 'Verified'. Show the application reference number and the name of the service associated with the application."
},
{
"role": "assistant",
"content": "SELECT\n T1.reference_number,\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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List all customers who have two policies with overlapping coverage periods and show both policy numbers along with the overlap start and end dates."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id, p1.policy_number AS policy_number1, p2.policy_number 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 insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "Could you provide a count of services available within each department?"
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) FROM hospitality_technology.services GROUP BY department;"
},
{
"role": "user",
"content": "Now, only list the depa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services ( service_id.text, property_id.text, service_name.text, description.text, category.text... |
[
{
"role": "user",
"content": "What is the average trade price for each asset for trades executed between '2024-05-01' and '2024-05-31'?"
},
{
"role": "assistant",
"content": "SELECT\n asset_id,\n AVG(price) AS avg_price\nFROM trading_platform.trades\nWHERE traded_at >= '2024-05-01' AND traded_... | 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.trades (
trade_id character varying(64) NOT NULL, -- unique identifier for the trade
order_id... |
[
{
"role": "user",
"content": "Show notifications where the target is a conversation, including the notification ID, recipient ID, and the creation time. Also include the conversation's group name if it's a group chat."
},
{
"role": "assistant",
"content": "SELECT n.notification_id, n.recipient_u... | 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... |
[
{
"role": "user",
"content": "Show me all terminated drivers who had worked for the company for more than 5 years before termination."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, hire_date FROM transportation.drivers WHERE status = 'Terminated' AND (hire_date <... | 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 character varying(64) NOT NULL, -- unique identifier for the driver
employe... |
[
{
"role": "user",
"content": "For each transaction, find its immediate next transaction by the same sender, listing the original transaction_id, the next transaction_id, and the time difference in minutes between them."
},
{
"role": "assistant",
"content": "SELECT t1.transaction_id AS current_tx... | 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": "How many unique hashtags has each post been associated with? Please return post_id and unique_hashtag_count."
},
{
"role": "assistant",
"content": "SELECT post_id, COUNT(DISTINCT hashtag_id) AS unique_hashtag_count\nFROM social_media.post_hashtags\nGROUP BY post_id;... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text )
CREATE TABLE social_media.conversati... |
[
{
"role": "user",
"content": "List all NFT collections from the sui_nfts table where the owner is not null, including their name and collection_type."
},
{
"role": "assistant",
"content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL;"
},
{
"role": "user",
"cont... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "Now, sort the results by the date opened, oldest first, and show only the top 10."
},
{
"role": "assistant",
"content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Cri... | 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": "Get a list of room types along with their property name and the count of rooms currently Available for each type."
},
{
"role": "assistant",
"content": "SELECT rt.type_name, p.property_name, COUNT(r.room_id) AS available_rooms_count\nFROM hospitality_technology.room... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Show me the driver first_name, last_name, and the name of the destination location for all trips scheduled to depart between '2024-05-01' and '2024-05-31'."
},
{
"role": "assistant",
"content": "SELECT d.first_name, d.last_name, l.name AS destination_name\nFROM tran... | 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": "List each hashtag_id along with the total number of distinct posts it's linked to."
},
{
"role": "assistant",
"content": "SELECT hashtag_id, COUNT(DISTINCT post_id) AS post_count\nFROM social_media.post_hashtags\nGROUP BY hashtag_id;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "List all trades with their order_id, trade_type, and commission for trades with commission higher than 100."
},
{
"role": "assistant",
"content": "SELECT trade_id, order_id, trade_type, commission FROM financial_services.trades WHERE commission > 100;"
},
{
... | 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 text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Can you list all patients along with the insurance plan names they are enrolled in? Please include patient ID, first name, last name, and plan name."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, ip.plan_name\nFROM healthcare.... | 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": "List all users whose email notifications are disabled, showing their usernames and the last time their settings were updated."
},
{
"role": "assistant",
"content": "SELECT u.username, us.updated_at\nFROM social_media.users u\nJOIN social_media.user_settings us ON u.... | 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... |
[
{
"role": "user",
"content": "How many doctors are affiliated with each hospital?"
},
{
"role": "assistant",
"content": "SELECT hospital_affiliation_id, COUNT(*) AS doctor_count\nFROM healthcare.doctors\nGROUP BY hospital_affiliation_id;"
},
{
"role": "user",
"content": "Filter to 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... |
[
{
"role": "user",
"content": "List the plan_id, plan_name, and plan_type for all insurance plans where the insurance_provider is 'Humana'."
},
{
"role": "assistant",
"content": "SELECT\n plan_id,\n plan_name,\n plan_type\nFROM healthcare.insurance_plans\nWHERE\n insurance_provider = 'Humana'... | 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": "List all Sui NFT collections where the owner is not null, including their name and collection_type."
},
{
"role": "assistant",
"content": "SELECT name, collection_type FROM sui_nfts WHERE owner != 'null';"
},
{
"role": "user",
"content": "Can you filter ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "List all room numbers with their room type name and property name for rooms that have a Jacuzzi feature."
},
{
"role": "assistant",
"content": "SELECT r.room_number, rt.type_name, p.property_name\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.room... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "Find consecutive pairs of trips for each vehicle based on the scheduled departure time."
},
{
"role": "assistant",
"content": "WITH RankedTrips AS (\n SELECT\n trip_id,\n vehicle_id,\n scheduled_departure,\n origin_location_id,\n destination_location... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"role": "user",
"content": "List pairs of maintenance logs for the same vehicle where the service date is the same, showing the log IDs and service types."
},
{
"role": "assistant",
"content": "SELECT T1.log_id AS log_id_1, T1.service_type AS service_type_1, T2.log_id AS log_id_2, T2.service_t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Can you show me all diagnoses with code_type 'ICD-9' that were made in 2022, including diagnosis_id, patient_id, diagnosis_code, and diagnosis_date?"
},
{
"role": "assistant",
"content": "SELECT diagnosis_id, patient_id, diagnosis_code, diagnosis_date FROM healthcar... | 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.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "List all smart money token inflows, showing the token symbol, chain, and USD value."
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, usd_value FROM smart_money_token_inflow;"
},
{
"role": "user",
"content": "Filter that list to only sho... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.t... |
[
{
"role": "user",
"content": "List each driver along with the driver_id of the driver who was hired immediately after them."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS current_driver_id, d2.driver_id AS next_driver_id FROM transportation.drivers d1 LEFT JOIN transportation.driv... | 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 the number of clients grouped by status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS client_count FROM legal_services.clients GROUP BY status;"
},
{
"role": "user",
"content": "Can you exclude statuses with fewer than 10 cli... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Find pairs of locations that are in the same state or province but are in different cities. Show their names, cities, and the state/province."
},
{
"role": "assistant",
"content": "SELECT\n l1.name AS location1_name,\n l2.name AS location2_name,\n l1.city AS loca... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ... |
[
{
"role": "user",
"content": "List the first names, last names, and work emails of employees who have the same job title as their direct manager."
},
{
"role": "assistant",
"content": "SELECT e1.first_name, e1.last_name, e1.work_email\nFROM government_services.employees e1\nJOIN government_servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, depa... |
[
{
"role": "user",
"content": "List all public reviews from the past 30 days with the property name and overall rating."
},
{
"role": "assistant",
"content": "SELECT r.review_id, p.property_name, r.rating_overall, r.review_date\nFROM hospitality_technology.reviews AS r\nJOIN hospitality_technolog... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List all active employees with their employee_id, full name, and their manager's first and last name."
},
{
"role": "assistant",
"content": "SELECT e.employee_id,\n CONCAT(e.first_name, ' ', e.last_name) AS employee_name,\n CONCAT(m.first_name, ' ', m.la... | 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 player's username and the titles of games they've played, along with the total number of sessions per game. Only include combinations where the session count is at least 3."
},
{
"role": "assistant",
"content": "SELECT p.username,\n g.title,\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.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "Retrieve each agent's ID, full name, and the count of 'Pending' policies they have sold with a premium_amount greater than 2000. Order the results by the policy count descending."
},
{
"role": "assistant",
"content": "SELECT a.agent_id,\n a.first_name || ' ' |... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "Find pairs of items from the same game, where one item is of type 'Weapon' and the other is of type 'Consumable'. List the game ID, the name of the weapon, and the name of the consumable."
},
{
"role": "assistant",
"content": "SELECT i1.game_id, i1.item_name AS weap... | 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.in_game_items ( item_id.uuid, game_id.uuid, item_name.text, item_type.text, description.text, rarity.... |
[
{
"role": "user",
"content": "Show me prescription_id, prescription_date, medication_id, and the chief_complaint from the linked medical record for all prescriptions where quantity_dispensed is greater than 10."
},
{
"role": "assistant",
"content": "SELECT p.prescription_id,\n p.prescripti... | 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.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appoi... |
[
{
"role": "user",
"content": "I want each user with the date and action of their most recent log entry, along with how many log entries they have in the last 7 days."
},
{
"role": "assistant",
"content": "WITH recent_logs AS (\n SELECT user_id, action, logged_at,\n ROW_NUMBER() OVER (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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "List pairs of citizens who share the same email domain."
},
{
"role": "assistant",
"content": "SELECT c1.first_name AS first1,\n c1.last_name AS last1,\n c2.first_name AS first2,\n c2.last_name AS last2,\n SPLIT_PART(c1.contact_email, '@', 2)... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List all doctors who have created at least one medical record in March 2024, including their full name and the count of records."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(m.record_id) AS record_count FROM healthcare.... | 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "Show the count of services available for each category."
},
{
"role": "assistant",
"content": "SELECT category, COUNT(service_id) AS service_count FROM government_services.services GROUP BY category;"
},
{
"role": "user",
"content": "Only include categor... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Can you list all assets along with their names and types, but only show assets whose symbol contains the letter 'A'?"
},
{
"role": "assistant",
"content": "SELECT asset_id, name, symbol, type FROM trading_platform.assets WHERE symbol LIKE '%A%';"
},
{
"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 trading_platform.assets ( asset_id text PRIMARY KEY, name text, symbol text, type text )
|
[
{
"role": "user",
"content": "Could you provide a list of all employees along with their manager's full name and the branch_id where they work?"
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_name 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 financial_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the employee
... |
[
{
"role": "user",
"content": "Retrieve the first and last names of all doctors who specialize in Cardiology."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name\nFROM healthcare.doctors\nWHERE specialty = 'Cardiology';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "Show me the top 3 smart money token inflows by USD value where the trade type is buying (type = 1), including the token symbol and narrative."
},
{
"role": "assistant",
"content": "SELECT token_symbol, narrative, usd_value FROM smart_money_token_inflow WHERE type = ... | 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": "List the group chat names and the creation dates for all group chats that have a last message sent in 2024."
},
{
"role": "assistant",
"content": "SELECT group_name, created_at FROM social_media.conversations WHERE is_group_chat = TRUE AND last_message_at >= '2024-0... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... |
[
{
"role": "user",
"content": "Which smart money address on the 'Ethereum' chain has the highest profit from tokens in the 'DeFi' narrative, and what is their ROI?"
},
{
"role": "assistant",
"content": "SELECT sm.address, sm.profit, sm.roi\nFROM smart_money_profit sm\nJOIN smart_money_token_inflo... | 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, --... |
[
{
"role": "user",
"content": "List all service orders for spa services in the last month, including the guest ID and total price."
},
{
"role": "assistant",
"content": "SELECT order_id, guest_id, total_price FROM hospitality_technology.service_orders WHERE service_id LIKE 'SPA%' AND order_timest... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "I want to find pairs of service locations within the same city but with different postal codes. Show both location IDs and the city."
},
{
"role": "assistant",
"content": "SELECT a.location_id AS location_id1, b.location_id AS location_id2, a.city\nFROM service_loca... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.service_locations ( location_id text PRIMARY KEY, agency_id text, location_name text, address text,... |
[
{
"role": "user",
"content": "List each token_id and the number of transfers recorded for that token."
},
{
"role": "assistant",
"content": "SELECT token_id, COUNT(*) AS transfer_count\nFROM web3.token_transfers\nGROUP BY token_id;"
},
{
"role": "user",
"content": "Actually, only inc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Which SUI coins have 'exists' status and what is the total balance across all owners for each coin_type? Please include coin_type, symbol, name, and total_balance."
},
{
"role": "assistant",
"content": "SELECT sc.coin_type,\n sm.symbol,\n sm.name,\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, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "I need the average capacity of vehicles for each fuel_type."
},
{
"role": "assistant",
"content": "SELECT fuel_type,\n AVG(capacity) AS avg_capacity\nFROM transportation.vehicles\nGROUP BY fuel_type;"
},
{
"role": "user",
"content": "Only include 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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "List all narratives that have a market cap between 500,000,000 and 5,000,000,000 USD and a positive price change over the last 7 days. Show the narrative name, market cap, and price change percentage for the last 7 days."
},
{
"role": "assistant",
"content": "SELECT... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"role": "user",
"content": "Retrieve the number of distinct guests for each service order status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(DISTINCT guest_id) AS guest_count\nFROM hospitality_technology.service_orders\nGROUP BY status;"
},
{
"role": "user",
"conte... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List service orders showing order ID, quantity, total price, and the name of the service ordered."
},
{
"role": "assistant",
"content": "SELECT T1.order_id, T1.quantity, T1.total_price, T2.service_name FROM hospitality_technology.service_orders AS T1 INNER JOIN hosp... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city.... |
[
{
"role": "user",
"content": "Show me all employees (employee_id, first_name, last_name) in the 'Investment' department who have processed loans (loan_id) with a principal amount greater than $100,000, along with the count of such loans for each employee."
},
{
"role": "assistant",
"content": "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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"role": "user",
"content": "For each user, show how many users registered after them. Return the user_id, username, and the count of later registrants."
},
{
"role": "assistant",
"content": "SELECT u1.user_id, u1.username, COUNT(u2.user_id) AS later_user_count FROM web3.users u1 LEFT 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.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "For each chain, find the token with the highest price and the token with the lowest price. List chain, high_price_token, max_price, low_price_token, and min_price."
},
{
"role": "assistant",
"content": "WITH max_prices AS (\n SELECT chain,\n token_symbol 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 token_dexpool_info (",
"pair_address character varying(512) NOT NULL, -- the id of dexpool",
"token_name cha... |
[
{
"role": "user",
"content": "Show me the top 5 users who placed the most orders in the last 7 days, along with the total quantity of assets they ordered."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(order_id) AS total_orders, SUM(quantity) AS total_quantity FROM trading_platform... | 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.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch... |
[
{
"role": "user",
"content": "Provide a count of agencies grouped by their jurisdiction level."
},
{
"role": "assistant",
"content": "SELECT jurisdiction_level, COUNT(*) FROM government_services.agencies GROUP BY jurisdiction_level;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id text, agency_name text, jurisdiction_level text, primary_contact_email text, m... |
[
{
"role": "user",
"content": "List all service orders with quantity greater than 3, showing the order ID, total price, and the staff member who placed the order."
},
{
"role": "assistant",
"content": "SELECT order_id, total_price, staff_id_ordered\nFROM hospitality_technology.service_orders\nWHE... | 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": "Can you provide a summary of how many securities exist for each combination of exchange and sector?"
},
{
"role": "assistant",
"content": "SELECT exchange, sector, COUNT(*) AS total_count\nFROM financial_services.securities\nGROUP BY exchange, sector;"
},
{
... | 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": "Which items have been acquired by players in the last 7 days? Show the item name, rarity, and total quantity acquired across all players."
},
{
"role": "assistant",
"content": "SELECT i.item_name, i.rarity, SUM(pi.quantity) AS total_acquired\nFROM gaming_technology.... | 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": "Please provide the first name, last name, and the total number of trips completed by each driver."
},
{
"role": "assistant",
"content": "SELECT T1.first_name , T1.last_name , COUNT(T2.trip_id) FROM transportation.drivers AS T1 JOIN transportation.trips AS T2 ON T1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "Find pairs of invoices belonging to the same client and having the same status, excluding pairs with the same invoice ID. Show the client ID, shared status, and both invoice numbers."
},
{
"role": "assistant",
"content": "SELECT T1.client_id, T1.status, T1.invoice_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 legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date... |
[
{
"role": "user",
"content": "Show me the document_id, document_name, and upload_timestamp for all documents uploaded by lawyer with ID 'lawyer_456'."
},
{
"role": "assistant",
"content": "SELECT document_id, document_name, upload_timestamp\nFROM legal_services.documents\nWHERE uploaded_by_lawye... | 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 character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex... |
[
{
"role": "user",
"content": "What is the number of guests per country, grouped by country_code?"
},
{
"role": "assistant",
"content": "SELECT country_code,\n COUNT(*) AS guest_count\nFROM hospitality_technology.guests\nGROUP BY country_code;"
},
{
"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 hospitality_technology.guests ( guest_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, la... |
[
{
"role": "user",
"content": "Provide the total number of reservations made for each property, including the property name and reservation count."
},
{
"role": "assistant",
"content": "SELECT p.property_name, COUNT(r.reservation_id) AS reservation_count\nFROM hospitality_technology.properties 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Show me the usernames of all users who have placed orders for assets that have associated metadata with the key 'network'. Also include the asset name and symbol."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, a.name AS asset_name, a.symbol\nFROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Show each player's ID along with the name and quantity of every item they have in their inventory. Join the player inventory with item details."
},
{
"role": "assistant",
"content": "SELECT pi.player_id, igi.item_name, pi.quantity FROM gaming_technology.player_inven... | 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, name text, country text, founded_year integer, website text, created_... |
[
{
"role": "user",
"content": "Show me all active electric vehicles along with their make, model, and license plate, ordered by acquisition date with the newest first."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, make, model, license_plate, acquisition_date FROM transportation.vehicl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "Show the total amount of tokens transferred for each token_id along with the number of transfers involving each token."
},
{
"role": "assistant",
"content": "SELECT token_id, SUM(value) AS total_transferred, COUNT(*) AS transfer_count FROM web3.token_transfers GROUP... | 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.token_transfers ( transfer_id text, token_id text, from_address text, to_address text, value numeric, transaction_... |
[
{
"role": "user",
"content": "List all patients who have had appointments and were prescribed a medication manufactured by 'Merck'. Show the patient ID, full name, appointment ID, and medication name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT p.patient_id, p.first_name, p.last_name,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Show the number of trips operated by each driver along with the earliest and latest scheduled departure dates for them."
},
{
"role": "assistant",
"content": "SELECT driver_id, COUNT(*) AS trip_count, MIN(scheduled_departure) AS first_departure, MAX(scheduled_depart... | 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, route_id text, vehicle_id text, driver_id text, scheduled_departure timestamp, act... |
[
{
"role": "user",
"content": "Find the earliest uploaded document for each claim. Show the claim_id, document_id, file_name, and uploaded_at."
},
{
"role": "assistant",
"content": "SELECT cd.claim_id, cd.document_id, cd.file_name, cd.uploaded_at\nFROM insurance.claim_documents cd\nINNER JOIN (\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 insurance.claim_documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "Count the number of transactions for each status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS tx_count\nFROM web3.transactions\nGROUP BY status;"
},
{
"role": "user",
"content": "Actually, only include statuses with more than 1000 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 web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price... |
[
{
"role": "user",
"content": "List all metadata entries showing the metadata_id, asset_id, key, and value."
},
{
"role": "assistant",
"content": "SELECT metadata_id, asset_id, key, value FROM metadata"
}
] | 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.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Which users have sent messages in multiple different conversations? Show the user ID and the count of unique conversations."
},
{
"role": "assistant",
"content": "SELECT sender_user_id, COUNT(DISTINCT conversation_id) AS unique_conversation_count FROM social_media.m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "List all Sui NFT collections where the owner is not null, including their name and collection_type, sorted by name."
},
{
"role": "assistant",
"content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL ORDER BY name ASC;"
},
{
"role": "us... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ... |
[
{
"role": "user",
"content": "List the first name, last name, and contact email of all agents whose status is 'Active'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, contact_email FROM insurance.agents WHERE status = 'Active';"
}
] | 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": "For each Bitcoin token tick, find the wallet address holding the largest amount and include the creator from token_info_bitcoin."
},
{
"role": "assistant",
"content": "SELECT b.tick,\n b.wallet_address,\n CAST(b.amount AS DECIMAL) AS max_amount,\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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "How many insurance products are currently marked as inactive?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM insurance.insurance_products WHERE is_active = false;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "List all contracts along with their deployer address and status for contracts deployed on the same network as '0xabc123...'. Also, include the deployment timestamp."
},
{
"role": "assistant",
"content": "SELECT c1.contract_id, c1.address, c1.deployer_address, c1.sta... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Find pairs of beneficiaries on the same policy who were added on the exact same date. Show policy_id, beneficiary1_id, beneficiary2_id, and the added_at date."
},
{
"role": "assistant",
"content": "SELECT T1.policy_id, T1.beneficiary_id AS beneficiary1_id, T2.benefi... | 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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "List all medical records along with the chief complaint and record date for patients who had their medical record created after March 1, 2023 and whose record was created by doctor with ID 'doctor_123'."
},
{
"role": "assistant",
"content": "SELECT record_id, patien... | 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.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d... |
[
{
"role": "user",
"content": "Calculate the average payment amount for all completed payments associated with services categorized as 'Healthcare'."
},
{
"role": "assistant",
"content": "SELECT AVG(T1.amount) FROM government_services.payments AS T1 INNER JOIN government_services.applications 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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "Find all users along with another user who shares their email domain."
},
{
"role": "assistant",
"content": "SELECT u1.user_id, u1.username, u2.user_id AS other_user_id, u2.username AS other_username\nFROM web3.users u1\nJOIN web3.users u2 ON split_part(u1.email, '@... | 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 character varying(64) NOT NULL, -- unique identifier for the user
username character vary... |
[
{
"role": "user",
"content": "Show me all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a security_type of 'ETF', along with their issuer_name and currency."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, security... | 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 prescription ID, medication ID, and the record ID for all prescriptions linked to medical records where the chief complaint contains 'cough'."
},
{
"role": "assistant",
"content": "SELECT T1.prescription_id, T1.medication_id, T1.record_id FROM healthcare.prescr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "Find narratives with a market cap greater than $500,000,000 and a 7-day price change percentage above 5%. Show the narrative, market_cap, and price_change_percentage_7d."
},
{
"role": "assistant",
"content": "SELECT narrative, market_cap, price_change_percentage_7d ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"role": "user",
"content": "Find all pairs of drivers who share the same status. Include both driver_ids, full names, and the shared status."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id, d1.first_name || ' ' || d1.last_name AS driver1_name, d2.driver_id AS driver2_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 transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "Count the number of medications provided by the manufacturer 'Novartis'."
},
{
"role": "assistant",
"content": "SELECT count(*) FROM healthcare.medications WHERE manufacturer = 'Novartis'"
}
] | 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 PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "Show the usernames and email addresses of users who have commented on their own posts."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, u.email\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = u.user_id\nJOIN social_media.pos... | 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, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "List all claims (claim ID, incident date, status) for policies where at least one beneficiary has a percentage share greater than 50%. Also include the policy number."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.claim_id, T1.incident_date, T1.status, T1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.