conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "List all room types along with the name of the property they belong to. Show the room type name, property name, and base rate." }, { "role": "assistant", "content": "SELECT t1.type_name, t2.property_name, t1.base_rate FROM hospitality_technology.room_types AS t1 JOI...
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, property_id text, type_name text, description text, base_rate nu...
[ { "role": "user", "content": "Find the username, email, and total number of orders placed by each user." }, { "role": "assistant", "content": "SELECT u.username, u.email, COUNT(o.order_id) AS order_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.wallets w ON u.user_id = w.user_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 trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "For each chain, which token had the highest number of smart money addresses buying it this week? Show the token symbol and narrative too." }, { "role": "assistant", "content": "SELECT chain, token_symbol, narrative, MAX(address_amount) AS max_buyers FROM smart_money...
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 smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character...
[ { "role": "user", "content": "What is the current number of passengers at station with ID 'ST123' right now?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the current number of passengers at a station. The data I have access to only includes static details ...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.s...
[ { "role": "user", "content": "特定の組み立てラインに割り当てられた従業員とそのラインの手順情報を取得したいです。従業員ID、名前、職種と手順名、手順番号を含めてください。" }, { "role": "assistant", "content": "db.employees.aggregate([\n { $match: { assigned_line_id: '<specific_line_id>' } },\n { $lookup: {\n from: 'assembly_steps',\n localField...
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 Collection 'assembly_steps'. Document structure: { _id: <ObjectId (or step_id)>, step_id: String,...
[ { "role": "user", "content": "List narratives with a market cap over $1,000,000,000, ordered by market cap descending." }, { "role": "assistant", "content": "SELECT narrative, market_cap FROM narrative_info WHERE market_cap > 1000000000 ORDER BY market_cap DESC;" }, { "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 narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume...
[ { "role": "user", "content": "Give me a list of transactions for the past 14 days for accounts that are currently Open. Include the transaction_id, amount, account_number, and transaction_date." }, { "role": "assistant", "content": "SELECT t.transaction_id, t.amount, a.account_number, t.transact...
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 character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "Show me all maintenance logs for 'Oil Change' services performed in the last 3 months, including the vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE 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, -- unique identifier for the maintenance ...
[ { "role": "user", "content": "能否帮我统计数据库中所有乘客的数量,按忠诚计划ID分组?" }, { "role": "assistant", "content": "SELECT loyalty_program_id, COUNT(*) as passenger_count\nFROM passengers\nGROUP BY loyalty_program_id;" } ]
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 // PUT /schedules { "mappings": { "properties": { "schedule_id": { "type": "keyword" ...
[ { "role": "user", "content": "For each vehicle, show vehicle_id, make, model, the earliest and latest fuel log IDs with their timestamps." }, { "role": "assistant", "content": "WITH extremes AS (\n SELECT vehicle_id,\n MIN(log_timestamp) AS first_ts,\n MAX(log_timestamp) AS last...
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": "For each private conversation (is_group_chat = false), list the conversation_id and the usernames of its two participants." }, { "role": "assistant", "content": "SELECT c.conversation_id,\n u1.username AS participant_one,\n u2.username AS participant_two...
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": "Show me the balances held by the 'Coinbase' exchange. For each token, list the token symbol, balance, and the current price from the token basic info table." }, { "role": "assistant", "content": "SELECT ctb.token_symbol, ctb.balance, tbi.price FROM cex_token_balance...
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": "I want to know how many hashtags have been used for posts whose IDs correspond to conversation IDs. Return conversation_id and hashtag_count." }, { "role": "assistant", "content": "SELECT cp.conversation_id, COUNT(ph.hashtag_id) AS hashtag_count\nFROM social_media.c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.post_hashtags ( post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hash...
[ { "role": "user", "content": "List each group conversation with its group name and the number of verified users who have posted in it." }, { "role": "assistant", "content": "SELECT c.conversation_id, c.group_name, COUNT(DISTINCT u.user_id) AS verified_posters\nFROM social_media.conversations c\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 text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Which routes have their origin and destination in the same city? Show the route number, description, and the origin and destination location IDs." }, { "role": "assistant", "content": "SELECT r.route_number, r.description, r.origin_location_id, r.destination_locatio...
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": "What is the total sum of amounts paid for all invoices?" }, { "role": "assistant", "content": "SELECT SUM(amount_paid) FROM invoices;" }, { "role": "user", "content": "Group this total by the status of the invoice." }, { "role": "assistant", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man...
[ { "role": "user", "content": "Show the guest's full name, reservation ID, check-in date, and status for all reservations made via 'Phone'." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, r.reservation_id, r.check_in_date, r.status FROM hospitality_technology.reservations...
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": "List all premium payments along with the email of the customer and the document_id of any claim documents related to claims made on the same policy." }, { "role": "assistant", "content": "SELECT pp.payment_id, pp.amount_paid, pp.payment_date, c.email, cd.document_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.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "Show me each participant in group chats with their username, conversation ID, join date, and last read date." }, { "role": "assistant", "content": "SELECT cp.conversation_id, u.username, cp.joined_at, cp.last_read_at\nFROM social_media.conversation_participants cp\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, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "List each employee's first and last name along with the count of active services offered by their agency." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, COUNT(s.service_id) AS active_service_count\nFROM government_services.employees e\nJOIN...
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": "Can you show the total quantity of items acquired on each calendar day?" }, { "role": "assistant", "content": "SELECT DATE(acquired_at) AS acquisition_date, SUM(quantity) AS total_items_acquired FROM gaming_technology.player_inventory GROUP BY acquisition_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 gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for...
[ { "role": "user", "content": "For each reservation, show the guest's first and last name, the property name, and the names of all services ordered during that reservation." }, { "role": "assistant", "content": "SELECT r.reservation_id, g.first_name, g.last_name, p.property_name, s.service_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 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 developers that share the same website domain. For each pair, show both developer names and the domain." }, { "role": "assistant", "content": "SELECT d1.name AS developer1, d2.name AS developer2, d1.domain AS domain\nFROM (\n SELECT develope...
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": "List the appointment ID, subject, and duration in minutes for all completed appointments." }, { "role": "assistant", "content": "SELECT appointment_id, subject, EXTRACT(EPOCH FROM (end_time - start_time))/60 AS duration_minutes FROM legal_services.appointments 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 legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "Show me all documents that have a version greater than 2 and include the document name, upload timestamp, and description." }, { "role": "assistant", "content": "SELECT document_id, document_name, upload_timestamp, description FROM legal_services.documents WHERE ver...
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 top 3 smart money addresses by profit on the Ethereum chain, along with their most profitable token and ROI." }, { "role": "assistant", "content": "SELECT address, most_profit_token, roi FROM smart_money_profit WHERE chain = 'Ethereum' ORDER BY profit DE...
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, -- the top 3 token...
[ { "role": "user", "content": "Show me the full name and email of clients whose status is 'prospect' and who registered before 2023-01-01." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE status = 'prospect' AND date_registered < '2023-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 legal_services.clients ( client_id character varying(64) NOT NULL, -- unique identifier for the client first_n...
[ { "role": "user", "content": "How many total appointments have been recorded?" }, { "role": "assistant", "content": "SELECT count(*) FROM appointments;" }, { "role": "user", "content": "What is the count of appointments that have the status 'Completed'?" }, { "role": "assista...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, -- unique identifier for the service ...
[ { "role": "user", "content": "How many times is hashtag 'H001' used across all posts?" }, { "role": "assistant", "content": "SELECT COUNT(*)\nFROM social_media.post_hashtags\nWHERE hashtag_id = 'H001';" } ]
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 doctors who have prescribed medications with frequency 'Once daily', along with their specialties and the count of such prescriptions per doctor." }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, d.specialty, COUNT(pr.prescription_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, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me all claim documents that are medical reports and were uploaded in the last 3 months, along with their file sizes and claim IDs." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_size_bytes, uploaded_at 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 insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ...
[ { "role": "user", "content": "Count the number of prescriptions each doctor has written for medications manufactured by 'Pfizer' in the last 6 months." }, { "role": "assistant", "content": "SELECT p.doctor_id, COUNT(*) AS prescription_count\nFROM healthcare.prescriptions p\nJOIN healthcare.medic...
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 the address that has the highest total amount across all its UTXOs." }, { "role": "assistant", "content": "SELECT address FROM utxos GROUP BY address ORDER BY SUM(amount) DESC LIMIT 1;" } ]
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": "For each user, show their username and the total number of completed orders they have placed, along with the name of the asset for each order." }, { "role": "assistant", "content": "SELECT u.username, a.name AS asset_name, COUNT(o.order_id) AS completed_order_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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp ) CREATE TAB...
[ { "role": "user", "content": "Show me all documents along with the document name and type, together with both the upload_timestamp and the lawyer ID who uploaded them." }, { "role": "assistant", "content": "SELECT document_id, document_name, document_type, upload_timestamp, uploaded_by_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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "Find all active policies with a coverage limit of at least 1,000,000. List the policy_id, policy_number, and coverage_limit." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, coverage_limit\nFROM insurance.policies\nWHERE status = 'active' AND ...
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, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "What is the count of securities for each security_type in the 'Financial' sector?" }, { "role": "assistant", "content": "SELECT security_type, COUNT(*) as security_count FROM financial_services.securities WHERE sector = 'Financial' GROUP BY security_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 financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu...
[ { "role": "user", "content": "How can I pair developers that share the same website domain? Show domain, dev1, dev2." }, { "role": "assistant", "content": "SELECT split_part(website, '/', 3) AS domain,\n d1.name AS dev1,\n d2.name AS dev2\nFROM gaming_technology.developers d1\nJOIN g...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ...
[ { "role": "user", "content": "How many addresses have a realized_ratio below 0.5?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE realized_ratio < 0.5;" } ]
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 smart_money_profit ( address.text, rank.numeric, profit.numeric, roi.numeric, realized_ratio.numeric, most_profit_token...
[ { "role": "user", "content": "Show me all trades for account 'ACC654321' executed after January 1, 2024." }, { "role": "assistant", "content": "SELECT *\nFROM financial_services.trades\nWHERE account_id = 'ACC654321' AND trade_timestamp > '2024-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 financial_services.trades ( trade_id character varying(64) NOT NULL, -- unique identifier for the trade account...
[ { "role": "user", "content": "List all guests who have a loyalty_member_id, showing their guest_id, first_name, last_name, and loyalty_member_id." }, { "role": "assistant", "content": "SELECT guest_id,\n first_name,\n last_name,\n loyalty_member_id\nFROM hospitality_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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "List guests currently checked into rooms on the 3rd floor, including their full name, room number, and check-in date." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T3.room_number, T2.check_in_date FROM hospitality_technology.guests AS 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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "Find the average time it takes for users to read notifications after they are sent." }, { "role": "assistant", "content": "SELECT AVG(EXTRACT(EPOCH FROM (read_at - sent_at))/3600) as avg_hours_to_read FROM trading_platform.notifications WHERE read_at IS NOT 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 trading_platform.notifications ( notification_id text PRIMARY KEY, user_id text, message text, sent_at timestamp, read_...
[ { "role": "user", "content": "For each driver, show their driver_id, first_name, last_name, along with any other driver whose license_expiry_date is earlier than theirs." }, { "role": "assistant", "content": "SELECT d1.driver_id AS driver_id,\n d1.first_name,\n d1.last_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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their chain information." }, { "role": "assistant", "content": "SELECT token_symbol, chain, usd_value FROM smart_money_token_inflow WHERE type = 1 ORDER BY usd_value DES...
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, -- the top 3 token...
[ { "role": "user", "content": "List all events emitted by contracts where the transaction status was 'failed'." }, { "role": "assistant", "content": "SELECT e.* FROM web3.events e JOIN web3.transactions t ON e.transaction_id = t.transaction_id WHERE t.status = 'failed';" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for the event contract_id characte...
[ { "role": "user", "content": "Can you help me retrieve the inventory details for a specific component ID, including the quantity and warehouse location?" }, { "role": "assistant", "content": "HGETALL inv:<inventory_record_id>" }, { "role": "user", "content": "Can you also include the...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Use Hashes. Key pattern: 'inv:<inventory_record_id>'. Example: HSET inv:INVREC500 component_id "c...
[ { "role": "user", "content": "Give me a daily breakdown of the total number of payments and total amount processed in the last 14 days." }, { "role": "assistant", "content": "SELECT DATE(payment_timestamp) AS day, COUNT(*) AS payment_count, SUM(amount) AS total_amount\nFROM 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.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu...
[ { "role": "user", "content": "Get all pairs of services from the same department where one service is more expensive than another. Show department, service1_name, price1, service2_name, price2." }, { "role": "assistant", "content": "SELECT s1.department, s1.service_name AS service1_name, s1.pric...
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 PRIMARY KEY, property_id text, service_name text, description text, c...
[ { "role": "user", "content": "How many unique conversations have had at least one message sent?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT conversation_id) AS conversation_count FROM social_media.messages;" } ]
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 text PRIMARY KEY, conversation_id text, sender_user_id text, content text, media_url...
[ { "role": "user", "content": "Show me all the details for all policy beneficiaries." }, { "role": "assistant", "content": "SELECT * FROM insurance.policy_beneficiaries;" }, { "role": "user", "content": "Filter the results to only include beneficiaries for customer 'CUST987'." }, ...
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 PRIMARY KEY, policy_id text, customer_id text, first_name text, la...
[ { "role": "user", "content": "Can you provide a list of all maintenance logs for each vehicle, showing the make, model, log ID, service date, and service type?" }, { "role": "assistant", "content": "SELECT v.make, v.model, m.log_id, m.service_date, m.service_type\nFROM transportation.maintenance...
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": "List all developer names and their countries." }, { "role": "assistant", "content": "SELECT name, country FROM gaming_technology.developers;" }, { "role": "user", "content": "Filter the list to only include developers from countries that start with '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 gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_...
[ { "role": "user", "content": "List all policies that were issued in the year 2023, showing the policy number, start date, end date, and premium amount." }, { "role": "assistant", "content": "SELECT policy_number, start_date, end_date, premium_amount FROM insurance.policies WHERE issued_at >= '20...
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": "List the total value and count of transactions for each status, ordered by total value descending." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS transaction_count, SUM(value) AS total_value\nFROM web3.transactions\nGROUP BY status\nORDER BY total...
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": "Show me the top 5 addresses with the highest balances, along with their public keys." }, { "role": "assistant", "content": "SELECT address_id, public_key, balance FROM blockchain.addresses ORDER BY balance DESC LIMIT 5;" }, { "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 blockchain.addresses ( address_id.text, public_key.text, balance.numeric )
[ { "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 IS NOT NULL;" }, { "role": "user", "content": "Can you also ...
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": "Could you show me the total payment amount for each guest, including their first and last names?" }, { "role": "assistant", "content": "SELECT g.guest_id,\n g.first_name,\n g.last_name,\n SUM(p.amount) AS total_paid\nFROM hospitality_technology.gue...
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": "Show me all unread notifications sent in the last 24 hours, along with the user IDs and message content, ordered by when they were sent." }, { "role": "assistant", "content": "SELECT user_id, message, sent_at FROM trading_platform.notifications WHERE read_at 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 trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta...
[ { "role": "user", "content": "How many notifications have been sent for comments in total?" }, { "role": "assistant", "content": "SELECT COUNT(*)\nFROM social_media.notifications\nWHERE target_entity_type = 'comment';" } ]
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": "Show me all invoices where the total_amount is more than 2000, including the invoice number, the associated case name, and the full name of the client." }, { "role": "assistant", "content": "SELECT i.invoice_number, c.case_name, cl.first_name || ' ' || cl.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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "Show all SUI coins that are marked as 'exists' in both sui_coins and sui_coins_metadata, displaying their coin_type, symbol, name, and balance." }, { "role": "assistant", "content": "SELECT sc.coin_type, scm.symbol, scm.name, sc.balance FROM sui_coins sc JOIN sui_co...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "Show me the full name and hire date for all lawyers hired after 2022, along with the name of the law firm they work for." }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, l.hire_date, f.firm_name FROM legal_services.lawyers AS l JOIN legal_ser...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer first_n...
[ { "role": "user", "content": "Show me the security_id, open_price, close_price, and volume for all market data points where the adjusted_close_price increased by more than 5% compared to the previous day's close, along with the data_timestamp." }, { "role": "assistant", "content": "SELECT m1.sec...
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 bigint, security_id text, data_timestamp timestamp, open_price numeric, ...
[ { "role": "user", "content": "I need a list of agents along with their manager's contact email and phone number." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name, a.last_name, m.contact_email AS manager_email, m.contact_phone AS manager_phone FROM insurance.agents a LEFT JO...
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": "What is the average market cap and average 24-hour trading volume for tokens on each chain?" }, { "role": "assistant", "content": "SELECT chain, AVG(market_cap) AS average_market_cap, AVG(volume_24h) AS average_volume_24h FROM token_dexpool_info GROUP BY chain" },...
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, token_name character varying(100) NOT NULL, token_sy...
[ { "role": "user", "content": "Which users have commented on posts that include hashtags? Show their user IDs and the hashtag IDs." }, { "role": "assistant", "content": "SELECT DISTINCT c.user_id, ph.hashtag_id\nFROM social_media.comments c\nJOIN social_media.post_hashtags ph ON c.post_id = ph.po...
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 medical records created in the last 6 months." }, { "role": "assistant", "content": "SELECT * FROM healthcare.medical_records WHERE record_date >= CURRENT_DATE - INTERVAL '6 months';" }, { "role": "user", "content": "Now, narrow it down to re...
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": "Find the top 3 staff members who have responded to the most public reviews. Include their staff_id, first_name, last_name, and the count of responses." }, { "role": "assistant", "content": "SELECT\n s.staff_id,\n s.first_name,\n s.last_name,\n COUNT(*) AS respon...
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.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "How many smart money addresses fall into each rank bracket: 1-100, 101-1000, and 1001-5000? Show the bracket and the count of addresses." }, { "role": "assistant", "content": "SELECT CASE WHEN rank BETWEEN 1 AND 100 THEN '1-100' WHEN rank BETWEEN 101 AND 1000 THEN '...
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 cex_token_balance (", "snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ...
[ { "role": "user", "content": "For the Arbitrum chain, which three tokens have the greatest positive change in price over the last 1 hour? Please show their symbol, name, price, and 1-hour price change percentage." }, { "role": "assistant", "content": "SELECT token_symbol, token_name, price, pric...
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.text, token_name.text, token_symbol.text, chain.text, price.numeric, price_change_per...
[ { "role": "user", "content": "Show me all pairs of overlapping reservations at the same property, including both reservation IDs." }, { "role": "assistant", "content": "SELECT r1.reservation_id AS res1, r2.reservation_id AS res2\nFROM hospitality_technology.reservations r1\nJOIN hospitality_tech...
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 all transactions together with any event emitted in the same transaction, showing transaction ID, event name, and event emitted timestamp." }, { "role": "assistant", "content": "SELECT tx.transaction_id, ev.event_name, ev.emitted_at\nFROM web3.transactions tx\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 web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "List consecutive fueling events for each vehicle where the refill quantity increased compared to the previous event. Include vehicle_id, previous timestamp and quantity, current timestamp and quantity." }, { "role": "assistant", "content": "SELECT\n prev.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.fuel_logs ( fuel_log_id character varying(64) NOT NULL, -- unique identifier for the fuel log entry...
[ { "role": "user", "content": "Show the count of patients residing in each unique address, excluding any entries with no address listed." }, { "role": "assistant", "content": "SELECT address, COUNT(patient_id) AS patient_count FROM healthcare.patients WHERE address IS NOT NULL AND address != '' G...
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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "For each Sui coin type with status 'exists' in both sui_coins and sui_coins_metadata, calculate the average balance per owner. Include coin_type, symbol, name, description, and avg_balance. Sort by avg_balance descending." }, { "role": "assistant", "content": "SELEC...
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, for each item, the total number of times it has been acquired and the earliest date it was acquired. Also, show the number of unique players who have acquired each item." }, { "role": "assistant", "content": "SELECT item_id, COUNT(*) AS total_acquisitions, ...
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 NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, ite...
[ { "role": "user", "content": "I need to find all components associated with a specific supplier. Can you help with that?" }, { "role": "assistant", "content": "HGETALL component:<component_id>\nIF HGET component:<component_id> supplier_id = 'sup:ACME_AERO' THEN INCLUDE" }, { "role": "use...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe...
[ { "role": "user", "content": "For each fuel type, show the number of unique vehicles that have used it and the total quantity refueled." }, { "role": "assistant", "content": "SELECT f.fuel_type, COUNT(DISTINCT f.vehicle_id) AS vehicle_count, SUM(f.quantity) AS total_quantity\nFROM transportation...
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": "Count how many posts have media attachments." }, { "role": "assistant", "content": "SELECT count(*) FROM social_media.posts WHERE media_url IS NOT 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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "How many customers have a non-null phone number in your system?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM insurance.customers WHERE phone_number IS NOT 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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "What is the average age of customers by risk_profile for those in status 'Active'?" }, { "role": "assistant", "content": "SELECT risk_profile,\n AVG(DATE_PART('year', AGE(CURRENT_DATE, date_of_birth))) AS avg_age\nFROM financial_services.customers\nWHERE statu...
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": "List distinct patient IDs who have received a diagnosis from a doctor with 'Cardiology' specialty." }, { "role": "assistant", "content": "SELECT DISTINCT T1.patient_id FROM healthcare.diagnoses AS T1 JOIN healthcare.doctors AS T2 ON T1.doctor_id = T2.doctor_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 healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ...
[ { "role": "user", "content": "I want to identify pairs of players who unlocked the same achievement within one hour of each other. List player1_id, player2_id, achievement_id, and the time difference in minutes." }, { "role": "assistant", "content": "SELECT pa1.player_id AS player1_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 gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti...
[ { "role": "user", "content": "List all invoice numbers and their total amount for invoices that are overdue. Show the client ID and the due date as well." }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, client_id, due_date FROM legal_services.invoices WHERE due_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 legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date...
[ { "role": "user", "content": "Show the list of developer names and their corresponding website domains (the domain part of the website URL)." }, { "role": "assistant", "content": "SELECT name, \n CASE \n WHEN website LIKE 'http%' THEN SUBSTRING(website FROM '://([^/]+)')\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_...
[ { "role": "user", "content": "Find pairs of products that share the same product_type but have different is_active statuses. Return the product_type, active product_id, active product_name, inactive product_id, and inactive product_name." }, { "role": "assistant", "content": "SELECT a.product_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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Calculate for each player the timespan between their earliest and latest achievement unlocks." }, { "role": "assistant", "content": "SELECT pa_min.player_id,\n pa_max.max_time - pa_min.min_time AS span\nFROM (\n SELECT player_id,\n MIN(unlocked_at) 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 gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id...
[ { "role": "user", "content": "What is the average price of services grouped by category? Display category and average_price." }, { "role": "assistant", "content": "SELECT category, AVG(price) AS average_price FROM hospitality_technology.services GROUP BY category;" }, { "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 hospitality_technology.services ( service_id text PRIMARY KEY, property_id text, service_name text, description text, c...
[ { "role": "user", "content": "Show me all patients who have scheduled appointments with cardiology doctors, along with their appointment times and reasons." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, a.reason FROM healthcare.patients...
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 all metadata keys and their values for the asset with asset_id 'BTC'." }, { "role": "assistant", "content": "SELECT key, value FROM trading_platform.metadata WHERE asset_id = 'BTC';" }, { "role": "user", "content": "Now filter these results to 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 trading_platform.metadata ( metadata_id character varying(64) NOT NULL, -- unique identifier for the metadata ...
[ { "role": "user", "content": "Find all pairs of bookings on the same trip, showing both booking IDs, passenger IDs, and booking times." }, { "role": "assistant", "content": "SELECT b1.booking_id AS booking_id1,\n b1.passenger_id AS passenger1,\n b1.booking_time AS time1,\n b2.b...
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.bookings ( booking_id text, passenger_id text, trip_id text, seat_number text, booking_time timestamp, s...
[ { "role": "user", "content": "Show me all spa service orders in the last month with their guest IDs and total prices, along with the property names where these services were ordered." }, { "role": "assistant", "content": "SELECT so.guest_id, so.total_price, p.property_name FROM hospitality_techn...
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 developers who share the same website domain. Show each pair's names and the domain." }, { "role": "assistant", "content": "SELECT d1.name AS dev1,\n d2.name AS dev2,\n SPLIT_PART(SPLIT_PART(d1.website, '://', 2), '/', 1) AS domai...
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": "List all active agents along with their license_state and the full name of their manager." }, { "role": "assistant", "content": "SELECT a.agent_id,\n a.first_name,\n a.last_name,\n a.license_state,\n m.first_name || ' ' || m.last_name AS mana...
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 all lawyers and their hire dates." }, { "role": "assistant", "content": "SELECT first_name, last_name, hire_date FROM legal_services.lawyers;" }, { "role": "user", "content": "Now, only show lawyers hired after 2022." }, { "role": "assistant...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "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": "Retrieve all loans along with the corresponding customer's first and last name and the current principal balance." }, { "role": "assistant", "content": "SELECT l.loan_id, c.first_name, c.last_name, l.current_principal_balance\nFROM financial_services.loans l\nJOIN f...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "Show me all prescriptions, including the prescription ID, medication ID, prescription date, and the prescribing doctor's ID, for patients who have received more than 2 prescriptions." }, { "role": "assistant", "content": "SELECT prescription_id, medication_id, presc...
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.prescriptions ( prescription_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio...