system
stringlengths
290
8.23k
conversations
listlengths
2
8
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Show the count of services available for each category." }, { "role": "assistant", "content": "SELECT category, COUNT(service_id) AS service_count FROM government_services.services GROUP BY category;" }, { "role": "user", "content": "Only include categor...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List all patients who have been prescribed medications manufactured by 'AstraZeneca', showing patient ID, first and last name, medication name, and manufacturer." }, { "role": "assistant", "content": "SELECT DISTINCT p.patient_id, p.first_name, p.last_name, m.medica...
You are an SQL statement expert. Given the table 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, -- unique identifier for the asset name cha...
[ { "role": "user", "content": "List all assets mentioned in DApp descriptions along with the DApp name and URL." }, { "role": "assistant", "content": "SELECT a.name AS asset_name,\n a.symbol AS asset_symbol,\n d.name AS dapp_name,\n d.url\nFROM trading_platform.assets a\nJOIN tr...
You are an SQL statement expert. Given the table 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": "Retrieve the average base premium of insurance products for each product_type, including only types that have more than 5 products." }, { "role": "assistant", "content": "SELECT product_type, AVG(base_premium) AS avg_premium\nFROM insurance.insurance_products\nGROUP...
You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game ti...
[ { "role": "user", "content": "Can you show me the titles and release dates of all games developed by companies founded after 2018, as well as the name and country of each developer?" }, { "role": "assistant", "content": "SELECT g.title, g.release_date, d.name AS developer_name, d.country\nFROM 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "Show me a summary of all clients with the total number of invoices they've received and the sum of total_amount for those invoices." }, { "role": "assistant", "content": "SELECT cl.client_id,\n CONCAT(cl.first_name, ' ', cl.last_name) AS client_name,\n 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 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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "I want to retrieve each client's full name along with the subject and start time of their appointments." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS client_name, a.subject, a.start_time\nFROM legal_services.clients c\nJOIN lega...
You are an SQL statement expert. Given the table 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 a list of all customers from California along with their full names and phone numbers." }, { "role": "assistant", "content": "SELECT customer_id, first_name || ' ' || last_name AS full_name, phone_number FROM insurance.customers WHERE state = 'CA';" }, {...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "Show me all active agents who have handled claims with police reports, along with the count of such claims per agent." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name, a.last_name, COUNT(c.claim_id) as police_report_claims FROM insurance.agents...
You are an SQL statement expert. Given the table 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": "For each category, list all pairs of services where one is active and the other is inactive. Show the category, active service name, and inactive service name." }, { "role": "assistant", "content": "SELECT a.category,\n a.service_name AS active_service,\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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "For each patient, show their full name and the count of insurance plans they are enrolled in, as well as their earliest policy effective date." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, COUNT(pi.plan_id) AS plan_count, MIN(pi.effective_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, -- unique identifier for the route route_numb...
[ { "role": "user", "content": "List all bookings with their passenger_id and fare, ordered by booking_time in descending order." }, { "role": "assistant", "content": "SELECT booking_id, passenger_id, fare, booking_time FROM transportation.bookings ORDER BY booking_time DESC;" }, { "role":...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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": "Show me all invoices for cases with status 'Closed'." }, { "role": "assistant", "content": "SELECT T1.* FROM legal_services.invoices AS T1 JOIN legal_services.cases AS T2 ON T1.case_id = T2.case_id WHERE T2.status = 'Closed';" }, { "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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List appointment IDs, patient first and last names, and their chief complaint for appointments that have an associated medical record." }, { "role": "assistant", "content": "SELECT a.appointment_id, p.first_name, p.last_name, mr.chief_complaint\nFROM healthcare.appo...
You are an SQL statement expert. Given the table 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 inactive insurance products along with their creation dates." }, { "role": "assistant", "content": "SELECT product_name, created_at FROM insurance.insurance_products WHERE is_active = false;" }, { "role": "user", "content": "Now order them by th...
You are an SQL statement expert. Given the table 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": "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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Show me the top 3 peers by the number of active days (days they were last seen) in the last month, along with their IP addresses." }, { "role": "assistant", "content": "SELECT peer_id, ip_address, COUNT(DISTINCT DATE(last_seen)) AS active_days FROM trading_platform....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ...
[ { "role": "user", "content": "List the document ID, file name, and size for all documents uploaded in the last 30 days by user 'agent_smith' that are larger than 5 megabytes, ordered by upload time descending." }, { "role": "assistant", "content": "SELECT document_id, file_name, file_size_bytes ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.trades ( trade_id text, order_id text, buyer_id text, seller_id text, asset_id text, quantity numeric,...
[ { "role": "user", "content": "For each trade, show the buyer_id, seller_id, asset_id, quantity, and also include any metadata value where the key is 'exchange' for the asset involved." }, { "role": "assistant", "content": "SELECT t.buyer_id, t.seller_id, t.asset_id, t.quantity, m.value AS exchan...
You are an SQL statement expert. Given the table 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": "Show the first and last names of citizens along with the total amount of all payments associated with them." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , SUM(T2.amount) FROM government_services.citizens AS T1 JOIN government_services...
You are an SQL statement expert. Given the table 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, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "List the names and cities of all locations that have at least one fuel log entry recorded." }, { "role": "assistant", "content": "SELECT DISTINCT l.name, l.city\nFROM transportation.locations l\nJOIN transportation.fuel_logs f ON l.location_id = f.location_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 blockchain.addresses ( address_id.text, public_key.text, balance.numeric ) CREATE TABLE blockchain.wallets ( wallet_id ...
[ { "role": "user", "content": "Find all wallet addresses that don't have an associated user_id." }, { "role": "assistant", "content": "SELECT address_id FROM blockchain.wallets WHERE user_id IS NULL;" }, { "role": "user", "content": "Now show me these addresses along with their privat...
You are an SQL statement expert. Given the table 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": "Show user_id and post_id for users who have created posts and have a private profile." }, { "role": "assistant", "content": "SELECT p.user_id, p.post_id FROM social_media.posts AS p JOIN social_media.user_settings AS us ON p.user_id = us.user_id WHERE us.private_pro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "Show me all customers who have active policies with coverage limits over $1,000,000, along with their policy details and the product names." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name, p.policy_id, p.policy_number, p.start_...
You are an SQL statement expert. Given the table 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": "Get the five most recent public posts that have media_type = 'video', showing post_id, created_at, and the author's username." }, { "role": "assistant", "content": "SELECT\n p.post_id,\n p.created_at,\n u.username\nFROM social_media.posts p\nJOIN social_media.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 healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number...
[ { "role": "user", "content": "Can you show me all doctors affiliated with hospital ID 'HOSP1001', including their doctor ID, full name, and specialty?" }, { "role": "assistant", "content": "SELECT doctor_id, first_name, last_name, specialty FROM healthcare.doctors WHERE hospital_affiliation_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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "List users and their latest wallet address if they have one, ordered by username." }, { "role": "assistant", "content": "SELECT u.username, w.address FROM users u JOIN wallets w ON u.user_id = w.user_id WHERE w.created_at = (SELECT MAX(w2.created_at) FROM wallets w2...
You are an SQL statement expert. Given the table 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": "For each transaction, find the next transaction by the same sender. Show the original transaction_id as current_tx, the next transaction_id as next_tx, from_address, and the time difference in minutes between them." }, { "role": "assistant", "content": "SELECT t1.tr...
You are an SQL statement expert. Given the table 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": "Show me all active insurance products with a base premium less than $200, sorted by product type." }, { "role": "assistant", "content": "SELECT * FROM insurance.insurance_products WHERE is_active = true AND base_premium < 200 ORDER BY product_type;" }, { "ro...
You are an SQL statement expert. Given the table 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 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 transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text...
[ { "role": "user", "content": "Show each route's route_id and the total number of completed trips associated with it." }, { "role": "assistant", "content": "SELECT route_id, COUNT(*) AS completed_trip_count\nFROM transportation.trips\nWHERE status = 'Completed'\nGROUP BY route_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "List all Bitcoin token ticks and their creators from token_info_bitcoin." }, { "role": "assistant", "content": "SELECT tick, creator\nFROM token_info_bitcoin;" }, { "role": "user", "content": "Include the total amount held by all wallets for each tick fr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points....
[ { "role": "user", "content": "Find all pairs of achievement unlocks and item acquisitions by the same player where the item was acquired after the achievement was unlocked. List player_id, achievement_id, unlocked_at, item_id, and acquired_at." }, { "role": "assistant", "content": "SELECT pa.pla...
You are an SQL statement expert. Given the table 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": "Find all applications whose last update occurred on a weekend. Show application_id, citizen full name, last_updated_at, and status." }, { "role": "assistant", "content": "SELECT\na.application_id,\n(c.first_name || ' ' || c.last_name) AS full_name,\na.last_updated_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 social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp ) CREATE TABLE soc...
[ { "role": "user", "content": "Get the total number of participants per conversation along with the number of participants who have private profiles." }, { "role": "assistant", "content": "SELECT cp.conversation_id, COUNT(cp.user_id) AS total_participants, SUM(CASE WHEN us.private_profile THEN 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 financial_services.employees ( employee_id text PRIMARY KEY, first_name text, last_name text, job_title text, departmen...
[ { "role": "user", "content": "List all managers (employees who have other employees reporting to them) along with the count of their direct reports, showing only those with more than 5 reports." }, { "role": "assistant", "content": "SELECT e.employee_id, e.first_name, e.last_name, COUNT(r.employ...
You are an SQL statement expert. Given the table 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": "Show me all active insurance products that have a base premium less than $100, sorted by product type." }, { "role": "assistant", "content": "SELECT * FROM insurance.insurance_products WHERE is_active = true AND base_premium < 100 ORDER BY product_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 legal_services.appointments ( appointment_id character varying(64) NOT NULL, client_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "List all appointments that have a location specified and their status is not 'Cancelled'. Show the appointment ID, subject, and location." }, { "role": "assistant", "content": "SELECT appointment_id, subject, location FROM legal_services.appointments WHERE location ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address cha...
[ { "role": "user", "content": "Show the distribution of total supply for tokens, grouped into ranges like < 1 million, 1 million to 1 billion, and > 1 billion. Count how many tokens fall into each range." }, { "role": "assistant", "content": "SELECT CASE WHEN total_supply < 1000000 THEN '< 1 mill...
You are an SQL statement expert. Given the table 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": "Please provide the first name, last name, and the total number of trips completed by each driver." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , COUNT(T2.trip_id) FROM transportation.drivers AS T1 JOIN transportation.trips AS T2 ON T1...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp ) CREATE TAB...
[ { "role": "user", "content": "List the user ID, username, and wallet address for all users who have at least one unspent UTXO associated with any of their wallets." }, { "role": "assistant", "content": "SELECT DISTINCT T1.user_id, T1.username, T2.address FROM trading_platform.users AS T1 JOIN tr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch...
[ { "role": "user", "content": "Show me the top 5 users by the total amount of unspent UTXOs they have in their wallets, along with their wallet addresses." }, { "role": "assistant", "content": "SELECT w.user_id, w.address, SUM(u.amount) AS total_unspent_amount FROM trading_platform.wallets w 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 healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty...
[ { "role": "user", "content": "Find pairs of diagnoses for the same patient and diagnosis code, but where the 'status' is different between the two diagnoses. Show patient_id, diagnosis_code, the status of the first diagnosis (status1), and the status of the second diagnosis (status2)." }, { "role": ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "role": "user", "content": "List all document IDs and their corresponding location names for documents that are associated with applications assigned to a service location in the city of 'Los Angeles'." }, { "role": "assistant", "content": "SELECT d.document_id, sl.location_name\nFROM 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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "For each contract that has received transactions, list its address and the total value of Ether received." }, { "role": "assistant", "content": "SELECT T1.address, SUM(T2.value) FROM web3.contracts AS T1 JOIN web3.transactions AS T2 ON T1.address = T2.to_address GRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "Show me each wallet address along with the number of unread notifications for the user who owns that wallet." }, { "role": "assistant", "content": "SELECT w.address, COUNT(n.notification_id) AS unread_count\nFROM trading_platform.wallets w\nJOIN trading_platform.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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "List all maintenance logs for vehicles that are currently active, showing the vehicle ID and service type." }, { "role": "assistant", "content": "SELECT m.vehicle_id, m.service_type FROM transportation.maintenance_logs m JOIN transportation.vehicles v ON m.vehicle_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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "List all fundraising rounds where the average investment amount exceeded $10M, and show how many projects participated in each round." }, { "role": "assistant", "content": "SELECT rounds_name, COUNT(DISTINCT project_id) AS project_count, AVG(investment_value) AS avg...
You are an SQL statement expert. Given the table 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": "Display all invoices along with the associated case name and the full name of the client." }, { "role": "assistant", "content": "SELECT i.invoice_number, cs.case_name, c.first_name || ' ' || c.last_name AS client_full_name\nFROM legal_services.invoices i\nLEFT JOIN ...