system stringlengths 290 8.23k | conversations listlengths 2 8 |
|---|---|
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.service_locations ( location_id text, agency_id text, location_name text, address text, city text, ... | [
{
"role": "user",
"content": "Find the service locations that are not accessible and located in the state of 'California'. List their name, address, and city."
},
{
"role": "assistant",
"content": "SELECT location_name , address , city FROM government_services.service_locations WHERE is_access... |
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.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir... | [
{
"role": "user",
"content": "Get the number of direct reports for each manager, showing manager_id and report_count."
},
{
"role": "assistant",
"content": "SELECT manager_id,\n COUNT(*) AS report_count\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL\nGROUP BY manager_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 financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... | [
{
"role": "user",
"content": "List all accounts (account_id, account_number, balance) that have at least one trade with a total_amount greater than $50,000, along with the count of such trades for each account."
},
{
"role": "assistant",
"content": "SELECT a.account_id, a.account_number, a.balan... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... | [
{
"role": "user",
"content": "List all trips where the actual origin location is different from the scheduled origin location or the actual destination location is different from the scheduled destination location. Show trip ID, scheduled origin/destination location IDs, and actual origin/destination locati... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... | [
{
"role": "user",
"content": "List each claim_handler_id along with the number of claims they've handled and the total settlement_amount they've paid out."
},
{
"role": "assistant",
"content": "SELECT claim_handler_id,\n COUNT(*) AS total_claims,\n SUM(settlement_amount) AS total_set... |
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": "I want to find all pairs of invoices belonging to the same client. Show me the client_id, the invoice_number for the earlier invoice and the invoice_number for the later invoice."
},
{
"role": "assistant",
"content": "SELECT i1.client_id,\n i1.invoice_number A... |
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 pairs of vehicles in the same depot with different status. Include both vehicle IDs with their statuses and the depot_id."
},
{
"role": "assistant",
"content": "SELECT v1.vehicle_id AS vehicle1_id,\n v1.status AS status1,\n v2.vehicle_id... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... | [
{
"role": "user",
"content": "List pairs of distinct routes where the origin of one route is the destination of the other, and the destination of the first route is the origin of the second. Include the route IDs and numbers for both routes in each pair."
},
{
"role": "assistant",
"content": "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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text,... | [
{
"role": "user",
"content": "List the name and latest price for all tokens that have a price listed."
},
{
"role": "assistant",
"content": "SELECT t1.name, t2.price FROM token_metas AS t1 JOIN token_prices AS t2 ON t1.contract_address = t2.address WHERE t2.timestamp IN (SELECT MAX(timestamp) FR... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... | [
{
"role": "user",
"content": "Show pairs of time entries for the same lawyer on the same date with different billing rates, including both entry IDs, the lawyer ID, the work date, and both billing rates."
},
{
"role": "assistant",
"content": "SELECT a.entry_id AS entry1_id, b.entry_id AS entry2_... |
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": "Get the property name, room type name, base rate, and star rating for all room types with a base_rate above 200 in properties located in the USA, sorted by base_rate in descending order."
},
{
"role": "assistant",
"content": "SELECT p.property_name, rt.type_name, rt... |
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": "Show me all policies where the total percentage share of beneficiaries exceeds 100%, along with the policy IDs and the sum of percentage shares."
},
{
"role": "assistant",
"content": "SELECT policy_id, SUM(percentage_share) AS total_percentage FROM insurance.policy_... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... | [
{
"role": "user",
"content": "List all claims along with the corresponding policy number and the full names of all beneficiaries associated with each policy."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, p.policy_number, b.first_name || ' ' || b.last_name AS beneficiary_... |
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": "Show me all properties in California along with the count of staff members at each property, ordered by staff count in descending order."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, COUNT(s.staff_id) AS staff_count FROM hospitality_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 hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ... | [
{
"role": "user",
"content": "List pairs of overlapping reservations for the same room, including both reservation IDs, room_id, and each reservation's check-in and check-out dates."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id AS reservation_id_1,\n r2.reservation_id 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 legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man... | [
{
"role": "user",
"content": "How many law firms were founded after 2010, and what are their names and phone numbers?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS firm_count FROM legal_services.law_firms WHERE founded_date > '2010-01-01';"
},
{
"role": "user",
"content":... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... | [
{
"role": "user",
"content": "For each fundraising round in 2022 and 2023, list the round name, the year, the total investment_value, and the count of distinct projects. Also include the average market_cap of associated tokens by matching project_name to token_symbol in token_basic_info."
},
{
"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 government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... | [
{
"role": "user",
"content": "Show the IDs and registration dates of all verified citizens who could be eligible for at least one active service. Display the citizen ID and registration date."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.citizen_id, c.registration_date\nFROM governmen... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... | [
{
"role": "user",
"content": "Show me the top 5 users by the total number of trades they participated in as sellers, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT t.seller_id, w.address, COUNT(t.trade_id) AS total_trades FROM trading_platform.trades t JOIN trad... |
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": "For each customer, could you list their full name, email, and the combined balance of all their accounts? Please also show the number of accounts they hold."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name || ' ' || c.last_name AS full_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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... | [
{
"role": "user",
"content": "Which users have 'traveler' in their bio and are located in 'New York'? Please show their usernames, full names, and locations."
},
{
"role": "assistant",
"content": "SELECT username, full_name, location FROM social_media.users WHERE bio ILIKE '%traveler%' AND locat... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... | [
{
"role": "user",
"content": "Get each property's name, manager_staff_id, and the number of rooms with status 'OutOfOrder', including properties with zero OutOfOrder rooms."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.manager_staff_id, COUNT(r.room_id) AS out_of_order_count\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.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... | [
{
"role": "user",
"content": "I want to retrieve all agents along with the number of active policies they've sold and the average premium amount of those active policies. Please include agent_id, first_name, last_name, policy_count, avg_premium. Sort the results by policy_count in descending order."
},
... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eli... | [
{
"role": "user",
"content": "Find pairs of active services from the same agency where one service's average processing time is longer than the other's. Display the agency_id, the slower service name with its processing time, and the faster service name with its processing time."
},
{
"role": "assis... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo... | [
{
"role": "user",
"content": "Show me all premium payments made via credit card in the last 30 days, along with their policy IDs and payment amounts, sorted by payment date in descending order."
},
{
"role": "assistant",
"content": "SELECT policy_id, amount_paid, payment_date FROM insurance.prem... |
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 PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... | [
{
"role": "user",
"content": "List all wallet addresses that have unspent UTXOs with amounts greater than 100, along with the total unspent amount for each address."
},
{
"role": "assistant",
"content": "SELECT w.address, SUM(u.amount) AS total_unspent FROM trading_platform.wallets w JOIN tradin... |
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": "Find all patients who have both an emergency contact and a phone number, and show their full names along with the emergency contact name and phone number, sorted by last name."
},
{
"role": "assistant",
"content": "SELECT CONCAT(first_name, ' ', last_name) AS 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.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i... | [
{
"role": "user",
"content": "List the diagnosis code, diagnosis description, and dosage of each prescription for cases where prescriptions are linked to diagnoses for the same patient and doctor."
},
{
"role": "assistant",
"content": "SELECT d.diagnosis_code, d.description AS diagnosis_descript... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... | [
{
"role": "user",
"content": "I want to know the total expenditure of each player on rare items, showing their player_id and total spent."
},
{
"role": "assistant",
"content": "SELECT pi.player_id,\n SUM(igi.cost_amount * pi.quantity) AS total_spent\nFROM gaming_technology.player_inventory... |
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, -- unique identifier for the guest profil... | [
{
"role": "user",
"content": "Find guests who have made at least one payment using a 'CreditCard'. List their full name (first and last name) and email address."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name, T1.email FROM hospitality_technology.guests AS T1 J... |
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": "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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... | [
{
"role": "user",
"content": "Show me the top 5 NFT collections on Ethereum with the highest number of unique owners, along with their names and floor prices."
},
{
"role": "assistant",
"content": "SELECT nc.name, nc.floor_price, COUNT(DISTINCT nh.wallet_address) AS unique_owners FROM nft_collec... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room... | [
{
"role": "user",
"content": "How many reservations does each room_type have, including property_id and room_type_id?"
},
{
"role": "assistant",
"content": "SELECT property_id,\n room_type_id,\n COUNT(*) AS reservation_count\nFROM hospitality_technology.reservations\nGROUP BY propert... |
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.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... | [
{
"role": "user",
"content": "List each agent along with their manager's contact_email. Include agent_id, first_name, last_name, manager_id, and manager's contact_email."
},
{
"role": "assistant",
"content": "SELECT a.agent_id,\n a.first_name,\n a.last_name,\n a.manager_id,\n ... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... | [
{
"role": "user",
"content": "List the usernames and user IDs of all users whose bio contains the word 'developer'."
},
{
"role": "assistant",
"content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';"
}
] |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquire... | [
{
"role": "user",
"content": "For each player, calculate the total quantity of items they have acquired. Return player_id and total_quantity."
},
{
"role": "assistant",
"content": "SELECT player_id,\n SUM(quantity) AS total_quantity\nFROM gaming_technology.player_inventory\nGROUP BY player... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments (
payment_id character varying(64) NOT NULL, -- unique identifier for the payment
po... | [
{
"role": "user",
"content": "Find all pairs of overlapping payment periods for the same customer. Return customer_id, first payment_id as payment1_id, second payment_id as payment2_id, and both periods' start and end dates."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n 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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... | [
{
"role": "user",
"content": "Give me the number of active customers grouped by city."
},
{
"role": "assistant",
"content": "SELECT city, COUNT(*) AS customer_count FROM financial_services.customers WHERE status = 'Active' GROUP BY city;"
},
{
"role": "user",
"content": "Actually, on... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... | [
{
"role": "user",
"content": "Show me the document name and the date worked for time entries logged by the same lawyer."
},
{
"role": "assistant",
"content": "SELECT T1.document_name , T2.date_worked FROM documents AS T1 JOIN time_entries AS T2 ON T1.uploaded_by_lawyer_id = T2.lawyer_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 hospitality_technology.staff (
staff_id character varying(64) NOT NULL, -- unique identifier for the staff member
... | [
{
"role": "user",
"content": "Find staff who both started and left their position in the same calendar year. Show their staff_id, full name, hire date, and termination date."
},
{
"role": "assistant",
"content": "SELECT staff_id, CONCAT(first_name, ' ', last_name) AS full_name, hire_date, termin... |
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": "List all patients who have been prescribed medications with dosage greater than 100mg, including their names and the medication details."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, m.medication_name, m.generic_name, pr.dosage FROM health... |
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
// db.createCollection('passengers')
// Optional: db.passengers.createIndex({ passenger_id: 1 }, ... | [
{
"role": "user",
"content": "Can you help me retrieve the details of passengers who are part of a specific loyalty program with ID 'LOYALTY123'?"
},
{
"role": "assistant",
"content": "db.passengers.find({ loyalty_program_id: 'LOYALTY123' }, { first_name: 1, last_name: 1, email: 1, phone_number:... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol ch... | [
{
"role": "user",
"content": "List all tokens with a price below $1 and a 24-hour trading volume over $5 million."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE price < 1 AND total_volume::numeric > 5000000;"
}
] |
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": "Show the document ID, file name, and the first 100 characters of the description for claim documents that have a description."
},
{
"role": "assistant",
"content": "SELECT document_id, file_name, SUBSTRING(description FROM 1 FOR 100) FROM insurance.claim_documents 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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... | [
{
"role": "user",
"content": "List all drivers whose licenses are set to expire within the next 60 days, along with their full name, license number, and contact number."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, license_number, contact_number\nFROM transporta... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... | [
{
"role": "user",
"content": "Show me the appointment ID, subject, and the full name of the lawyer for all appointments where a location is specified."
},
{
"role": "assistant",
"content": "SELECT T2.appointment_id, T2.subject, T1.first_name, T1.last_name FROM legal_services.lawyers AS T1 JOIN 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 social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... | [
{
"role": "user",
"content": "For each group conversation, show its name and the creation time of the earliest notification associated with it."
},
{
"role": "assistant",
"content": "SELECT c.group_name, MIN(n.created_at) AS earliest_notification_time FROM social_media.conversations AS c JOIN so... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document i... | [
{
"role": "user",
"content": "Find the citizen ID and document ID for documents with a 'Proof of Address' document type, for citizens who have also received at least one notification. Show distinct combinations."
},
{
"role": "assistant",
"content": "SELECT DISTINCT d.citizen_id, d.document_id F... |
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... | [
{
"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 project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... | [
{
"role": "user",
"content": "What is the average ROI for smart money addresses on the Ethereum chain with a realized profit ratio above 50%?"
},
{
"role": "assistant",
"content": "SELECT AVG(roi) AS average_roi FROM smart_money_profit WHERE chain = 'Ethereum' AND realized_ratio > 50;"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.