conversations listlengths 2 8 | system stringlengths 301 7.4k |
|---|---|
[
{
"role": "user",
"content": "Calculate the total value of unspent UTXOs for each user whose KYC status has been 'approved'."
},
{
"role": "assistant",
"content": "SELECT kyc.user_id, SUM(u.amount) FROM trading_platform.kyc_audit kyc JOIN trading_platform.utxos u ON kyc.user_id = u.user_id WHERE... | 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.utxos ( utxo_id.text, transaction_id.text, output_index.integer, address.text, amount.numeric, spent.b... |
[
{
"role": "user",
"content": "For each trip, provide the trip ID, the name of the vehicle's make and model, and the total quantity of fuel used during that trip."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, v.make, v.model, SUM(f.quantity) AS total_fuel_used\nFROM transportation.trip... | 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": "Show me all active managers along with their first and last names, and the count of staff members they supervise, ordered by the supervised staff count in descending order."
},
{
"role": "assistant",
"content": "SELECT s1.staff_id, s1.first_name, s1.last_name, COUNT... | 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": "List policy IDs, policy numbers, start dates, and premium amounts for policies issued in the last 90 days with a premium amount greater than 5000."
},
{
"role": "assistant",
"content": "SELECT policy_id, policy_number, start_date, premium_amount FROM insurance.polic... | 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 PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "For each relationship type among policy beneficiaries, count how many beneficiaries exist of that type. Provide relationship and count, ordered by count descending."
},
{
"role": "assistant",
"content": "SELECT relationship,\n COUNT(*) AS beneficiary_count\nFR... | 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "For each user, show their username and the timestamp of their most recent notification. Include users who have never received notifications."
},
{
"role": "assistant",
"content": "SELECT T1.username, max(T2.sent_at) FROM users AS T1 LEFT JOIN trading_platform.notifi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"role": "user",
"content": "List all SUI coins with status 'exists', including their coin_type, balance, and owner address."
},
{
"role": "assistant",
"content": "SELECT object_id, coin_type, balance, owner\nFROM sui_coins\nWHERE status = 'exists';"
},
{
"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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "List the user IDs, theme, and updated_at for users who have disabled email notifications, enabled push notifications, and have a private profile."
},
{
"role": "assistant",
"content": "SELECT user_id, theme, updated_at FROM social_media.user_settings WHERE email_not... | 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.user_settings ( setting_id.text, user_id.text, theme.text, email_notifications_enabled.boolean, push_notif... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens with decimals equal to 18."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, total_supply FROM token_metas WHERE ... | 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": "For each patient, show their full name and the count of insurance plans they are enrolled in, as well as their earliest policy effective date."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, COUNT(pi.plan_id) AS plan_count, MIN(pi.effective_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "List all users who have created wallets in the last 30 days, showing their usernames and wallet addresses."
},
{
"role": "assistant",
"content": "SELECT u.username, w.address FROM web3.users u JOIN web3.wallets w ON u.user_id = w.user_id WHERE w.created_at >= NOW() ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_at.timestamp, transaction_id.text, l... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with the count of available rooms at each property."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, p.city, p.star_rating, COUNT(r.room_id) AS available_rooms_coun... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Which bed types are offered in each property and how many different room types are associated with each bed type?"
},
{
"role": "assistant",
"content": "SELECT property_id, bed_type, COUNT(DISTINCT room_type_id) AS room_type_count FROM hospitality_technology.room_ty... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ... |
[
{
"role": "user",
"content": "Show me all guests from 'CA' along with their full name and email address."
},
{
"role": "assistant",
"content": "SELECT guest_id, CONCAT(first_name, ' ', last_name) AS full_name, email FROM hospitality_technology.guests WHERE country_code = 'CA';"
}
] | 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": "List pairs of distinct servers that share the same ip_address. Show server1_name, server2_name, and the shared ip_address."
},
{
"role": "assistant",
"content": "SELECT s1.server_name AS server1_name,\n s2.server_name AS server2_name,\n s1.ip_address\nFR... | 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.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara... |
[
{
"role": "user",
"content": "List each claim with its policy number and the selling agent's first and last name."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, p.policy_number, a.first_name, a.last_name\nFROM insurance.claims c\nJOIN insurance.policies p ON c.policy_id = p.policy_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 insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"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": "List each user along with the total number of public posts they have made, and the names of any hashtags associated with their posts."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(DISTINCT p.post_id) AS public_post_count, STRING_AGG(DIST... | 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": "What is the average commission for trades executed on the 'NYSE' venue?"
},
{
"role": "assistant",
"content": "SELECT AVG(commission) FROM financial_services.trades WHERE execution_venue = 'NYSE';"
}
] | 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.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.... |
[
{
"role": "user",
"content": "List the appointment ID, start time, and the case number for all appointments that are linked to a case."
},
{
"role": "assistant",
"content": "SELECT T1.appointment_id, T1.start_time, T2.case_number FROM legal_services.appointments AS T1 JOIN legal_services.cases 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 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": "Count the number of documents submitted for each service. Show the service_name and the document_count."
},
{
"role": "assistant",
"content": "SELECT s.service_name, COUNT(d.document_id) AS document_count\nFROM government_services.services s\nJOIN government_service... | 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": "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 the ticker symbol and security name for all securities that had a volume greater than 100000 on '2023-10-27'."
},
{
"role": "assistant",
"content": "SELECT T2.ticker_symbol, T2.security_name FROM financial_services.market_data AS T1 JOIN financial_services.secu... | 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.market_data (
data_point_id bigserial NOT NULL, -- auto-incrementing primary key
security_id... |
[
{
"role": "user",
"content": "List all vehicles where the capacity is less than or equal to 30. Include vehicle_id, make, model, and type."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, make, model, type FROM transportation.vehicles WHERE capacity <= 30;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "Count the number of transactions per sender for March 2023."
},
{
"role": "assistant",
"content": "SELECT sender_address, COUNT(*) AS tx_count\nFROM blockchain.transactions\nWHERE timestamp >= '2023-03-01' AND timestamp < '2023-04-01'\nGROUP BY sender_address;"
},... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri... |
[
{
"role": "user",
"content": "Count the total number of distinct specialties listed in the doctors table."
},
{
"role": "assistant",
"content": "SELECT count(DISTINCT specialty) FROM healthcare.doctors;"
}
] | 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": "Show me each room's number and the total amount of payments processed for that room."
},
{
"role": "assistant",
"content": "SELECT r.room_number, SUM(p.amount) AS total_payments\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.payments p ON r.room_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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "I need a report showing each passenger's total number of bookings and the date of their most recent booking."
},
{
"role": "assistant",
"content": "SELECT b.passenger_id,\n COUNT(*) AS total_bookings,\n MAX(b.booking_time) AS last_booking_date\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.routes ( route_id character varying(64) NOT NULL, route_number character varying(32) NOT NULL UNIQUE, de... |
[
{
"role": "user",
"content": "List the appointment ID, subject, location, and lawyer ID for all appointments where there is at least one other appointment with the same location and lawyer assigned."
},
{
"role": "assistant",
"content": "SELECT appointment_id, subject, location, lawyer_id FROM 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 legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ... |
[
{
"role": "user",
"content": "List all services in the 'Concierge' department along with their names, price, and whether they are currently available. Include the property name as well."
},
{
"role": "assistant",
"content": "SELECT s.service_name, s.price, s.is_available, p.property_name\nFROM h... | 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": "List all medication names, their manufacturers, and NDC codes."
},
{
"role": "assistant",
"content": "SELECT medication_name, manufacturer, ndc_code\nFROM healthcare.medications;"
},
{
"role": "user",
"content": "Now restrict to only those entries where ... | 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.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "List the policy number, premium amount, and the product name for each policy, but only for policies where the associated insurance product is active and has a base premium greater than 1200."
},
{
"role": "assistant",
"content": "SELECT p.policy_number, p.premium_am... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "List all passengers who have never made a booking, showing their passenger_id, first_name, last_name, and email."
},
{
"role": "assistant",
"content": "SELECT\n p.passenger_id,\n p.first_name,\n p.last_name,\n p.email\nFROM transportation.passengers p\nL... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Find the application IDs for applications that have received notifications through both 'Email' and 'SMS' channels."
},
{
"role": "assistant",
"content": "SELECT application_id FROM government_services.notifications WHERE channel IN ('Email', 'SMS') GROUP BY applica... | 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.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m... |
[
{
"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": "List the peer IDs and IP addresses for all peers where the port is greater than 1024."
},
{
"role": "assistant",
"content": "SELECT peer_id, ip_address \nFROM trading_platform.peers \nWHERE port > 1024"
}
] | 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 character varying(64) NOT NULL, name character varying(128) NOT NULL, symbol charact... |
[
{
"role": "user",
"content": "For each wallet, find the next wallet created by the same user. Return the user_id, the earlier wallet_id, the later wallet_id, and the time difference in minutes between their creation times."
},
{
"role": "assistant",
"content": "SELECT user_id,\n wallet_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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "List all guests from California who are loyalty members and have provided their email addresses, ordered by last name."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, loyalty_member_id FROM hospitality_technology.guests WHERE state_provin... | 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": "List all doctors who have not written any prescriptions. Return doctor_id, first_name, and last_name."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name FROM healthcare.doctors d LEFT JOIN healthcare.prescriptions p ON d.doctor_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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show all employees who are managers (i.e., have direct reports). Display the employee's full name, department, and the number of employees they manage."
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name, e.last_name, e.department, COUNT(r.empl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "For properties located in the city 'Los Angeles', list all rooms that are on floor 3. Include the property name and room number."
},
{
"role": "assistant",
"content": "SELECT p.property_name, r.room_number FROM hospitality_technology.properties p JOIN hospitality_te... | 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 PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "List pairs of partners in the same firm, showing each partner's full name and hire_date."
},
{
"role": "assistant",
"content": "SELECT p1.first_name || ' ' || p1.last_name AS partner1_name,\n p1.hire_date AS partner1_hire,\n p2.first_name || ' ' || p2.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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "List the medication names and dosage for all prescriptions issued for patient with ID 'patient_555'."
},
{
"role": "assistant",
"content": "SELECT m.medication_name, p.dosage\nFROM healthcare.prescriptions p\nJOIN healthcare.medications m ON p.medication_id = m.medi... | 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 policy number, start date, and the first and last name of the agent for all policies that started in 2024."
},
{
"role": "assistant",
"content": "SELECT p.policy_number, p.start_date, a.first_name AS agent_first_name, a.last_name AS agent_last_name\nFROM 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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all addresses that have created smart contracts, showing the address ID and its current balance."
},
{
"role": "assistant",
"content": "SELECT T1.address_id, T1.balance FROM blockchain.addresses AS T1 JOIN blockchain.smart_contracts AS T2 ON T1.address_id = T2.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks (
block_id character varying(64) NOT NULL, -- unique identifier for the block
previous_block... |
[
{
"role": "user",
"content": "List the full names of all employees who are currently employed (i.e., have no termination date)."
},
{
"role": "assistant",
"content": "SELECT first_name || ' ' || last_name AS full_name FROM government_services.employees WHERE termination_date IS NULL;"
}
] | 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 character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "Show all appointments with subject containing 'Review' and their corresponding case_id."
},
{
"role": "assistant",
"content": "SELECT appointment_id, subject, case_id\nFROM legal_services.appointments\nWHERE subject ILIKE '%Review%';"
}
] | 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": "List all chronic and active diagnoses for patient 'patient_456', including diagnosis_code, description, and diagnosis_date."
},
{
"role": "assistant",
"content": "SELECT diagnosis_code, description, diagnosis_date FROM healthcare.diagnoses WHERE patient_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.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty... |
[
{
"role": "user",
"content": "Show daily total transaction amounts and counts for completed 'Payment' transactions in USD for the last 7 days."
},
{
"role": "assistant",
"content": "SELECT t.effective_date AS date,\n SUM(t.amount) AS total_amount,\n COUNT(*) AS transac... | 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.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the trans... |
[
{
"role": "user",
"content": "List all inactive customers from California, showing their full names and the date they were created."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'California' AND status = 'Inactive';"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.