conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "List all events with their contract IDs and emitted timestamps, sorted by the most recent events first." }, { "role": "assistant", "content": "SELECT event_id, contract_id, emitted_at FROM web3.events ORDER BY emitted_at DESC;" }, { "role": "user", "cont...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_at.timestamp, transaction_id.text, l...
[ { "role": "user", "content": "For each vehicle, list the vehicle_id and the total number of trips it has performed." }, { "role": "assistant", "content": "SELECT vehicle_id, COUNT(*) AS trip_count FROM transportation.trips GROUP BY vehicle_id;" }, { "role": "user", "content": "Can yo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var...
[ { "role": "user", "content": "For each citizen who has made a payment for an application that is still in 'Processing' status, list their full name, application_id, payment_id, amount, currency, and the application status." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "I want to get the list of users and their total number of public posts made in the last month, including user_id and post_count." }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS post_count\nFROM social_media.posts\nWHERE visibility = 'public'\n AN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u...
[ { "role": "user", "content": "For each appointment, show the appointment subject, start time, the client's name, and the lawyer's email." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.subject, a.start_time, c.first_name || ' ' || c.last_name AS client_name, l.email AS lawyer_e...
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List all appointments scheduled in the next 7 days along with the appointment_id, appointment_time, patient's full name, doctor's full name, and the patient's primary insurance plan_name." }, { "role": "assistant", "content": "SELECT ap.appointment_id,\n ap.ap...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show me the conversation ID and creation time for group chats that have received at least one message." }, { "role": "assistant", "content": "SELECT DISTINCT T1.conversation_id, T1.created_at FROM social_media.conversations AS T1 INNER JOIN social_media.messages 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 social_media.likes ( like_id text, user_id text, post_id text, comment_id text, created_at timestamp ) CREATE TABLE soc...
[ { "role": "user", "content": "Find reservations where the same guest has overlapping stays in the same property." }, { "role": "assistant", "content": "SELECT r1.reservation_id AS res1,\n r2.reservation_id AS res2,\n r1.guest_id,\n r1.property_id\nFROM hospitality_technology.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 hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ...
[ { "role": "user", "content": "List all pairs of insurance products that share the same product_type but have different base premiums, showing both product_ids, their product_type, and their base_premiums." }, { "role": "assistant", "content": "SELECT p1.product_id AS product1_id, p2.product_id 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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "List all notifications that have not been read yet, including the notification message and the user_id." }, { "role": "assistant", "content": "SELECT notification_id, user_id, message\nFROM trading_platform.notifications\nWHERE 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, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "Find all invoices with status 'Paid' where the total amount is between 2000 and 5000. Show invoice number, total amount, issue date, and due date. Sort the results by issue date descending." }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, ...
You are an SQL statement expert. Given the table 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": "List the diagnosis code, diagnosis description, and dosage of each prescription for cases where prescriptions are linked to diagnoses for the same patient and doctor." }, { "role": "assistant", "content": "SELECT d.diagnosis_code, d.description AS diagnosis_descript...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i...
[ { "role": "user", "content": "Could you list the title of each game and the total quantity of items acquired by players for that specific game?" }, { "role": "assistant", "content": "SELECT g.title, SUM(pi.quantity) AS total_acquired_quantity FROM gaming_technology.games g JOIN gaming_technology...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date...
[ { "role": "user", "content": "Which exchanges have a total token USD value greater than 3,000,000 on the Polygon chain? Show the exchange name and their total USD value." }, { "role": "assistant", "content": "SELECT exchange, SUM(usd_value) AS total_usd_value\nFROM cex_token_balance\nWHERE 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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "Get the total number of logs per user for July 2024." }, { "role": "assistant", "content": "SELECT user_id,\n COUNT(*) AS log_count\nFROM trading_platform.logs\nWHERE logged_at BETWEEN '2024-07-01' AND '2024-07-31'\nGROUP BY user_id;" }, { "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 trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
[ { "role": "user", "content": "Show me the total premium amount paid by each customer, grouped by customer_id and payment_method." }, { "role": "assistant", "content": "SELECT customer_id, payment_method, SUM(amount_paid) AS total_paid\nFROM insurance.premium_payments\nGROUP BY customer_id, payme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo...
[ { "role": "user", "content": "Show me the top 5 users with the most wallet addresses, along with the count of their wallets." }, { "role": "assistant", "content": "SELECT user_id, COUNT(wallet_id) AS wallet_count FROM blockchain.wallets WHERE user_id IS NOT NULL GROUP BY user_id ORDER BY wallet_...
You are an SQL statement expert. Given the table 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.wallets ( wallet_id text, user_id text, address_id text, private_key text )
[ { "role": "user", "content": "List the top 5 Avalanche tokens by activity count in the past 7 days." }, { "role": "assistant", "content": "SELECT ta.tick,\n COUNT(*) AS activity_count\nFROM token_activities_avalanche ta\nWHERE ta.block_timestamp >= NOW() - INTERVAL '7 days'\nGROUP BY ta.ti...
You are an SQL statement expert. Given the table 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 all contracts with status 'active' and include their ABI length in characters." }, { "role": "assistant", "content": "SELECT contract_id, address, LENGTH(abi) AS abi_length FROM web3.contracts WHERE status = 'active';" }, { "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 web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Please show the names and bar numbers of all lawyers who have led appointments with more than 3 different clients." }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, l.bar_number\nFROM legal_services.lawyers l\nJOIN legal_services.appointments ...
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Can you provide the total number of sessions and the average session duration in seconds for each game_id and server_id pair?" }, { "role": "assistant", "content": "SELECT game_id, server_id, COUNT(*) AS total_sessions, AVG(duration_seconds) AS avg_duration_seconds\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, game_id ...
[ { "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": "List the tag names and creation dates for all hashtags created on June 12, 2024." }, { "role": "assistant", "content": "SELECT tag_name, created_at FROM social_media.hashtags WHERE created_at::date = '2024-06-12';" }, { "role": "user", "content": "Please...
You are an SQL statement expert. Given the table 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.hashtags ( hashtag_id text, tag_name text, created_at timestamp )
[ { "role": "user", "content": "List the first name and last name of citizens who have scheduled appointments, along with the scheduled start time and purpose of their appointments." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.scheduled_start_time, T2.purpose FROM ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "List the first name, last name, and status for all drivers." }, { "role": "assistant", "content": "SELECT first_name, last_name, status FROM transportation.drivers;" }, { "role": "user", "content": "How many drivers have a status of 'Active'?" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "List all peers that haven't been active for more than 7 days, along with their IP addresses and ports." }, { "role": "assistant", "content": "SELECT peer_id, ip_address, port FROM trading_platform.peers WHERE last_seen < NOW() - INTERVAL '7 days';" }, { "rol...
You are an SQL statement expert. Given the table 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": "List all users who have multiple wallets with the same address." }, { "role": "assistant", "content": "SELECT user_id, address, COUNT(*) AS duplicate_count FROM trading_platform.wallets GROUP BY user_id, address HAVING COUNT(*) > 1;" }, { "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 trading_platform.wallets ( wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet user_...
[ { "role": "user", "content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?" }, { "role": "assistant", "content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.develo...
You are an SQL statement expert. Given the table 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": "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": "I want to find the total number of players currently connected per region for each game." }, { "role": "assistant", "content": "SELECT\n s.region,\n s.game_id,\n SUM(s.current_players) AS total_players\nFROM gaming_technology.servers s\nGROUP BY\n s.region,\n s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "How many unique patient records are there for each gender?" }, { "role": "assistant", "content": "SELECT gender, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patients GROUP BY gender;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "List the names of agencies and the total standard fee sum for all active services they currently provide." }, { "role": "assistant", "content": "SELECT a.agency_name, SUM(s.standard_fee) AS total_active_service_fee\nFROM government_services.agencies a\nJOIN governme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e...
[ { "role": "user", "content": "我想查询某个飞机构建的所有检查记录,包括检查类型、检查结果、检查时间以及被检查的组件名称。" }, { "role": "assistant", "content": "MATCH (ab:AircraftBuild)-[:UNDERWENT]->(i:Inspection)-[:INSPECTED_COMPONENT]->(c:Component)\nWHERE ab.build_id = 'specific_build_id'\nRETURN i.inspection_type, i.result, i.inspectio...
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 Node Label ':AircraftModel'. Properties: { model_id: String (Constraint: UNIQUE), model_name: Str...
[ { "role": "user", "content": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count." }, { "role": "assistant", "content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHE...
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Show me all lawyers, their specializations, and the address of the law firm they work at." }, { "role": "assistant", "content": "SELECT l.first_name || ' ' || l.last_name AS lawyer_full_name, l.specialization, f.address\nFROM legal_services.lawyers l\nJOIN 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.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "For each trip, show the trip ID, vehicle ID, driver ID, and both the actual starting and ending location IDs." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id, origin_location_id, destination_location_id FROM transportation.trips;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance ...
[ { "role": "user", "content": "Show all DApps that have metadata linked to an asset with a key of 'category', including the DApp name, URL, and the associated asset_id." }, { "role": "assistant", "content": "SELECT d.name, d.url, m.asset_id\nFROM trading_platform.dapps d\nJOIN trading_platform.me...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the UTXO transaction...
[ { "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": "Find posts that have been liked by users the author of the post is following. List the post_id and the user_id of the post author." }, { "role": "assistant", "content": "SELECT p.post_id, p.user_id AS post_author_user_id FROM social_media.posts AS p JOIN social_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 social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi...
[ { "role": "user", "content": "Show the job title, first name, and last name of all employees who were hired before 2010-01-01." }, { "role": "assistant", "content": "SELECT job_title, first_name, last_name\nFROM government_services.employees\nWHERE hire_date < '2010-01-01';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "role": "user", "content": "How many lawyers who are partners were hired in each year? Show the hire year and the count." }, { "role": "assistant", "content": "SELECT strftime('%Y', hire_date) AS hire_year , count(lawyer_id) FROM legal_services.lawyers WHERE is_partner = true GROUP BY hire_...
You are an SQL statement expert. Given the table 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": "List booking IDs and fares for bookings associated with trips using vehicles that had maintenance logs recorded in the last 90 days." }, { "role": "assistant", "content": "SELECT T1.booking_id , T1.fare FROM transportation.bookings AS T1 JOIN transportation.trips A...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "What are the maintenance costs for a specific aircraft model like the Airbus A320?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to data regarding maintenance costs for specific aircraft models such as the Airbus A320. The information in ...
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 manufacturing.aircraft_mod...
[ { "role": "user", "content": "Show me the top 3 servers by the number of game sessions they've hosted, including server_name, region, and session_count." }, { "role": "assistant", "content": "SELECT\n s.server_name,\n s.region,\n COUNT(gs.session_id) AS session_count\nFROM gaming_technology.s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Show me all pairs of cases led by the same lawyer, including both case names and the lead lawyer ID." }, { "role": "assistant", "content": "SELECT c1.lead_lawyer_id,\n c1.case_name AS case_name_1,\n c2.case_name AS case_name_2\nFROM legal_services.cases ...
You are an SQL statement expert. Given the table 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": "List all fuel log IDs along with their vehicle IDs and odometer readings for logs where the quantity is below 10." }, { "role": "assistant", "content": "SELECT fuel_log_id, vehicle_id, odometer_reading\nFROM transportation.fuel_logs\nWHERE quantity < 10;" }, { ...
You are an SQL statement expert. Given the table 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 text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu...
[ { "role": "user", "content": "Which room types offer both 'Sea View' and 'Balcony' amenities? Show their type names, property IDs, and base rates." }, { "role": "assistant", "content": "SELECT type_name, property_id, base_rate FROM hospitality_technology.room_types WHERE amenities LIKE '%Sea Vie...
You are an SQL statement expert. Given the table 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": "List all citizens who registered in the last 90 days but haven't scheduled any appointments. Display their citizen_id, full name, and registration_date." }, { "role": "assistant", "content": "SELECT c.citizen_id,\n c.first_name || ' ' || c.last_name AS full_na...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "How many comments were made by user 'U999'?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.comments WHERE user_id = 'U999';" } ]
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "Find all pairs of partners who share the same specialization but work at different firms." }, { "role": "assistant", "content": "SELECT l1.first_name || ' ' || l1.last_name AS partner_one,\n l2.first_name || ' ' || l2.last_name AS partner_two,\n l1.speci...
You are an SQL statement expert. Given the table 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 all unique wallet addresses present in the system." }, { "role": "assistant", "content": "SELECT DISTINCT address FROM trading_platform.wallets;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "Show each policy number and the total amount paid for it across all premium payments received so far." }, { "role": "assistant", "content": "SELECT T1.policy_number, SUM(T2.amount_paid) FROM insurance.policies AS T1 JOIN insurance.premium_payments AS T2 ON T1.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.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Retrieve the product_id, product_name, base_premium, and created_at for all active insurance products with a base_premium greater than 1000, ordered by base_premium descending." }, { "role": "assistant", "content": "SELECT\n product_id,\n product_name,\n base_pre...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, -- unique identifier for the insurance pr...
[ { "role": "user", "content": "Find the total transfer volume for each Avalanche token over the past 7 days and include the token's creator." }, { "role": "assistant", "content": "SELECT a.tick,\n i.creator,\n SUM(a.amt) AS total_volume\nFROM token_activities_avalanche a\nJOIN token_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Show me all insurance plans that cover more than 10 patients as their primary insurance, along with the provider name and contact information." }, { "role": "assistant", "content": "SELECT ip.plan_name, ip.insurance_provider, ip.contact_phone, ip.website, COUNT(pi.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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List all pairs of time entries worked by the same lawyer on the same day but billed at different rates. Include both entry IDs, the lawyer_id, the date_worked, and each billing_rate." }, { "role": "assistant", "content": "SELECT t1.entry_id AS entry1_id,\n 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 legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi...
[ { "role": "user", "content": "List the tokens on the BSC chain that have a positive price change in the last 24 hours and a market cap over $10,000,000. Show the symbol, price, and market cap." }, { "role": "assistant", "content": "SELECT token_symbol, price, market_cap\nFROM token_basic_info\nW...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE token_basic_info (", "coin_id character varying(100) NOT NULL, -- the id of the token", "token_name character...
[ { "role": "user", "content": "Find pairs of active services from the same agency where one service's average processing time is longer than the other's. Display the agency_id, the slower service name with its processing time, and the faster service name with its processing time." }, { "role": "assis...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eli...
[ { "role": "user", "content": "List all clients, showing their full name, email, and phone number." }, { "role": "assistant", "content": "SELECT first_name, last_name, email, phone FROM legal_services.clients;" }, { "role": "user", "content": "Now, filter this list to include only cli...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique identifier for the client first_n...
[ { "role": "user", "content": "List the usernames of users who have sent messages containing the word 'urgent', along with the message content and sent time." }, { "role": "assistant", "content": "SELECT u.username, m.content, m.sent_at FROM social_media.messages m JOIN social_media.users u ON m....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message convers...
[ { "role": "user", "content": "Retrieve each agency’s name along with the count of accessible service locations it has in California." }, { "role": "assistant", "content": "SELECT\n a.agency_name,\n COUNT(l.location_id) AS accessible_location_count\nFROM government_services.agencies a\nJOIN gov...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "I need to get the total quantity of components in inventory for a specific warehouse location. Can you help with that?" }, { "role": "assistant", "content": "SELECT location_warehouse, SUM(quantity) AS total_quantity\nFROM component_inventory\nWHERE location_warehou...
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 Index 'aircraft_models'. Mapping: { properties: { model_id: { type: 'keyword' }, model_name: { ty...
[ { "role": "user", "content": "Can you provide the number of doctors grouped by their medical specialty?" }, { "role": "assistant", "content": "SELECT specialty, COUNT(*) AS doctor_count\nFROM healthcare.doctors\nGROUP BY specialty;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor first_name ...
[ { "role": "user", "content": "Get me a list of all clients along with the website of their law firm, matching on company_name = firm_name." }, { "role": "assistant", "content": "SELECT c.client_id, c.first_name, c.last_name, f.firm_name, f.website\nFROM legal_services.clients AS c\nJOIN legal_se...
You are an SQL statement expert. Given the table 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": "Retrieve the vehicle_id, make, model, and the next_service_due_date for each vehicle based on the most recent maintenance log." }, { "role": "assistant", "content": "SELECT DISTINCT ON (ml.vehicle_id) v.vehicle_id, v.make, v.model, ml.next_service_due_date FROM 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.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "List all accounts and their total outgoing transaction amounts. Please include the account_id, account_type, and the sum of outgoing amount." }, { "role": "assistant", "content": "SELECT a.account_id, a.account_type, COALESCE(SUM(t.amount), 0) AS total_outgoing_amou...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "Show me all maintenance logs for vehicles assigned to depots in 'Los Angeles'. For each log, list the log_id, vehicle_id, service_date, and depot name." }, { "role": "assistant", "content": "SELECT ml.log_id, ml.vehicle_id, ml.service_date, loc.name AS depot_name\nF...
You are an SQL statement expert. Given the table 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": "Can you show me the first and last names of employees along with the first and last names of their managers?" }, { "role": "assistant", "content": "SELECT e.first_name AS employee_first_name, e.last_name AS employee_last_name, m.first_name AS manager_first_name, m.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 government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, depa...
[ { "role": "user", "content": "Find employees who are managers and list the number of employees they directly manage. Show the manager's full name and the count of their direct reports." }, { "role": "assistant", "content": "SELECT m.first_name || ' ' || m.last_name AS manager_full_name, COUNT(e....
You are an SQL statement expert. Given the table 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": "Which game has the longest total session time across all its sessions?" }, { "role": "assistant", "content": "SELECT game_id, SUM(duration_seconds) AS total_session_time\nFROM gaming_technology.game_sessions\nGROUP BY game_id\nORDER BY total_session_time DESC\nLIMIT...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the ...
[ { "role": "user", "content": "Find the top 3 drivers by their average number of passengers per trip, including driver_id, first_name, last_name, and avg_passengers, ordered by avg_passengers descending." }, { "role": "assistant", "content": "SELECT d.driver_id,\n d.first_name,\n d.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 transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text...
[ { "role": "user", "content": "List all premium payments along with the full name of the agent who sold each policy and the name of the related insurance product." }, { "role": "assistant", "content": "SELECT pp.payment_id, pp.amount_paid, pp.payment_date, a.first_name AS agent_first_name, a.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 insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "List all posts that have never received a comment. Return post_id and user_id." }, { "role": "assistant", "content": "SELECT p.post_id, p.user_id FROM social_media.posts p WHERE NOT EXISTS (SELECT 1 FROM social_media.comments c WHERE c.post_id = p.post_id);" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "List the first and last name of each citizen along with the city and state of the service location for their agency." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_serv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "For each user, list their order_id, order_type, and any log messages they have generated." }, { "role": "assistant", "content": "SELECT\n o.user_id,\n o.order_id,\n o.order_type,\n l.action AS log_message\nFROM trading_platform.orders o\nJOIN trading_platform.lo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "List the first and last names of employees and the number of services offered by their agency." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, COUNT(s.service_id) AS service_count\nFROM government_services.employees e\nLEFT JOIN government_s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "Which customers have accounts in more than one state? Please show their customer_id, full name, and the list of states where they hold accounts." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name || ' ' || c.last_name AS full_name, STRING_AGG(...
You are an SQL statement expert. Given the table 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 the top 5 most recently minted NFTs on the Ethereum blockchain with their contract_address, token_id, name, and rarity_score from nft_metadata." }, { "role": "assistant", "content": "SELECT contract_address, token_id, name, rarity_score\nFROM nft_metadata\nW...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar ) CR...
[ { "role": "user", "content": "Could you please provide a list of patients along with the total count of chronic diagnoses they have received? Show the patient's ID, first name, last name, and the count." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Show all users who have joined at least two group chats, with their usernames and the names of the group chats they joined." }, { "role": "assistant", "content": "SELECT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.conversation_participants...
You are an SQL statement expert. Given the table 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": "For each room, find the next higher room_number on the same floor and property. Show room_id, property_id, floor, room_number, next_room_id, next_room_number." }, { "role": "assistant", "content": "SELECT r1.room_id,\n r1.property_id,\n r1.floor,\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.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "List the usernames and email addresses of users who have participated in group chats, along with the names of those group chats." }, { "role": "assistant", "content": "SELECT u.username, u.email, c.group_name\nFROM social_media.users u\nJOIN social_media.conversatio...
You are an SQL statement expert. Given the table 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": "List the booking ID, the first name, and the last name of the passenger for all bookings." }, { "role": "assistant", "content": "SELECT T1.booking_id , T2.first_name , T2.last_name FROM transportation.bookings AS T1 JOIN transportation.passengers AS T2 ON T1.passeng...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "List the description and diagnosis date for all diagnoses that are marked as chronic and were made in the year 2023." }, { "role": "assistant", "content": "SELECT description, diagnosis_date FROM healthcare.diagnoses WHERE is_chronic = true AND diagnosis_date BETWEE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor first_name ...
[ { "role": "user", "content": "For each lawyer, show their first name, last name, and the total number of documents they have uploaded, along with the names of the law firms they belong to." }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, f.firm_name, COUNT(d.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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Show me the top 5 users by the total number of trades they participated in as buyers, along with their email addresses." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, u.email, COUNT(t.trade_id) AS total_trades FROM trading_platform.users u JOIN...
You are an SQL statement expert. Given the table 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": "List all beneficiaries who have a percentage share greater than 75%. Show their first name, last name, and percentage share." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.percentage_share FROM insurance.policy_beneficiaries AS T1 WHER...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, -- unique identifier for the claim policy_id charac...
[ { "role": "user", "content": "Retrieve the distinct generic_name values and the number of medications for each generic_name, sorted by the count descending." }, { "role": "assistant", "content": "SELECT generic_name,\n COUNT(*) AS medication_count\nFROM healthcare.medications\nGROUP BY gen...
You are an SQL statement expert. Given the table 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 text, medication_name text, generic_name text, manufacturer text, ndc_code text,...
[ { "role": "user", "content": "Show me the historical balance entries for wallet address '0xabc...' and contract address '0xdef...', including the block number and amount." }, { "role": "assistant", "content": "SELECT block_number, amount FROM erc20_balances_historical WHERE wallet_address = '0xa...
You are an SQL statement expert. Given the table 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, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "I need a list of trip_id, status, and the corresponding vehicle's license_plate and fuel_type for trips that haven't yet begun." }, { "role": "assistant", "content": "SELECT t.trip_id, t.status, v.license_plate, v.fuel_type\nFROM transportation.trips t\nJOIN transpo...
You are an SQL statement expert. Given the table 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": "List the block ID and timestamp for all blocks that were mined after 2023-01-01 and also show the ID and timestamp of their direct successor block." }, { "role": "assistant", "content": "SELECT t1.block_id, t1.timestamp, t2.block_id AS successor_block_id, t2.timesta...
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 blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonc...
[ { "role": "user", "content": "For each trip, show the trip ID, the scheduled departure time, and the name of the origin and destination locations." }, { "role": "assistant", "content": "SELECT t.trip_id, t.scheduled_departure, lo.name AS origin_location_name, ld.name AS destination_location_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 transportation.drivers ( driver_id character varying(64) NOT NULL, -- unique identifier for the driver employe...
[ { "role": "user", "content": "Show me all SUI coins with status 'exists' and their symbol, name, and the number of decimals." }, { "role": "assistant", "content": "SELECT coin_type, symbol, name, decimals\nFROM sui_coins_metadata\nWHERE status = 'exists';" }, { "role": "user", "conte...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "How many game sessions has each player started? Show player ID and the total count." }, { "role": "assistant", "content": "SELECT player_id, count(*) AS session_count FROM game_sessions GROUP BY player_id;" }, { "role": "user", "content": "Only show play...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "I need to find, for each active agent, the number of active policies they have sold and the average premium_amount of those active policies." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name || ' ' || a.last_name AS agent_name, COUNT(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, -- unique identifier for the customer first_...
[ { "role": "user", "content": "List all users whose usernames start with the letter 'B'." }, { "role": "assistant", "content": "SELECT user_id, username, email, created_at FROM trading_platform.users WHERE username LIKE 'B%';" }, { "role": "user", "content": "Can you make it case-inse...
You are an SQL statement expert. Given the table 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": "Show me the top 5 tokens by 24-hour trading volume on the Ethereum chain, along with their narrative and 7-day price change percentage." }, { "role": "assistant", "content": "SELECT t.token_symbol, t.narrative, t.price_change_percentage_7d FROM token_basic_info t WH...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO...
[ { "role": "user", "content": "List the full names and email addresses of staff members who have delivered at least one service order in the past 30 days, along with the count of orders they delivered. Sort by count descending." }, { "role": "assistant", "content": "SELECT st.staff_id,\n st...
You are an SQL statement expert. Given the table 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 text, property_id text, first_name text, last_name text, position text, work_em...
[ { "role": "user", "content": "List all active agents with the number of open claims they've handled and the average settlement amount for their closed claims. Include agent_id, first_name, last_name, open_claims_count, and avg_settlement_closed." }, { "role": "assistant", "content": "SELECT a.ag...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d...
[ { "role": "user", "content": "Provide a count of nodes for each unique IP address and list the IP address along with its node count." }, { "role": "assistant", "content": "SELECT ip_address, COUNT(node_id) AS node_count FROM blockchain.nodes GROUP BY ip_address;" }, { "role": "user", ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen ti...