conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Show me all invoice numbers and due dates where the amount paid is exactly zero." }, { "role": "assistant", "content": "SELECT invoice_number, due_date FROM legal_services.invoices WHERE amount_paid = 0;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_...
[ { "role": "user", "content": "List all unique policies that have claim documents of type 'Claim Form'. For each, return the policy_number, start_date, end_date, and the document file_name." }, { "role": "assistant", "content": "SELECT DISTINCT p.policy_number, p.start_date, p.end_date, cd.file_n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "List the first and last names of citizens who have appointments scheduled with the employee whose employee_id is 'emp123'." }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name, T1.last_name FROM government_services.citizens AS T1 JOIN 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 character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "List the full names and positions of all staff members along with the name of the property they work for." }, { "role": "assistant", "content": "SELECT s.first_name || ' ' || s.last_name AS full_name, s.position, p.property_name\nFROM hospitality_technology.staff 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 hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir...
[ { "role": "user", "content": "List the medication names which have never been prescribed to any patient." }, { "role": "assistant", "content": "SELECT m.medication_name\nFROM healthcare.medications m\nLEFT JOIN healthcare.prescriptions p ON m.medication_id = p.medication_id\nWHERE p.prescription...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "Show me all room types with a base rate over $200 and max occupancy of at least 4, along with their property IDs and amenities." }, { "role": "assistant", "content": "SELECT room_type_id, property_id, type_name, base_rate, max_occupancy, amenities FROM hospitality_t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ...
[ { "role": "user", "content": "Show me all wallets that were created before 2024 and their associated user IDs." }, { "role": "assistant", "content": "SELECT wallet_id, user_id, address, created_at\nFROM trading_platform.wallets\nWHERE created_at < '2024-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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Can you show me each user's address and the date their wallet was created?" }, { "role": "assistant", "content": "SELECT user_id, address, created_at FROM trading_platform.wallets;" }, { "role": "user", "content": "Now, can you show only wallets created ...
You are an SQL statement expert. Given the table 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": "Calculate the total PNL and total Net Flow for all tokens recorded on the 'Arbitrum' chain." }, { "role": "assistant", "content": "SELECT SUM(pnl) as total_pnl, SUM(net_flow) as total_net_flow FROM smart_money_token_performance WHERE chain = 'Arbitrum';" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl...
[ { "role": "user", "content": "Show me all active managers along with their first and last names, and the count of staff members they supervise, ordered by the supervised staff count in descending order." }, { "role": "assistant", "content": "SELECT s1.staff_id, s1.first_name, s1.last_name, COUNT...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, -- unique identifier for the staff member ...
[ { "role": "user", "content": "List the full name of citizens who have an appointment scheduled at a service location in the state of 'New York'." }, { "role": "assistant", "content": "SELECT DISTINCT t1.first_name, t1.last_name FROM government_services.citizens AS t1 JOIN government_services.app...
You are an SQL statement expert. Given the table 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 me the top 5 smart money addresses by profit on the Ethereum chain, along with their most profitable token and ROI, but only include addresses with a realized profit ratio above 70%." }, { "role": "assistant", "content": "SELECT address, most_profit_token, roi ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_profit ( address character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres...
[ { "role": "user", "content": "Count the number of events for each hour of the day based on the emitted_at timestamp." }, { "role": "assistant", "content": "SELECT EXTRACT(HOUR FROM emitted_at) AS event_hour, COUNT(*) AS event_count FROM web3.events GROUP BY event_hour ORDER BY event_hour;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character...
[ { "role": "user", "content": "Show the number of active agents in each license state." }, { "role": "assistant", "content": "SELECT license_state,\n COUNT(*) AS active_agent_count\nFROM insurance.agents\nWHERE status = 'active'\nGROUP BY license_state;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l...
[ { "role": "user", "content": "Find all blocks where the difficulty is between 1000 and 2000." }, { "role": "assistant", "content": "SELECT * FROM blockchain.blocks WHERE difficulty BETWEEN 1000 AND 2000;" }, { "role": "user", "content": "Now filter these results to only show blocks 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 blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic...
[ { "role": "user", "content": "I want the number of peers per port, but only ports with more than 5 peers. List port and peer_count." }, { "role": "assistant", "content": "SELECT port, COUNT(*) AS peer_count\nFROM trading_platform.peers\nGROUP BY port\nHAVING COUNT(*) > 5;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch...
[ { "role": "user", "content": "Show all appointments along with the related medical record's record_id and chief complaint, for appointments scheduled in June 2024." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.patient_id, a.doctor_id, a.appointment_time, mr.record_id, mr.chie...
You are an SQL statement expert. Given the table 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.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi...
[ { "role": "user", "content": "Show me the latest uploaded document (name and version) for each invoice that is linked to a case, including the invoice number and total amount." }, { "role": "assistant", "content": "SELECT i.invoice_number, i.total_amount, d.document_name, d.version AS latest_ver...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "List the user ID, KYC status, and the number of UTXOs they have, including spent and unspent." }, { "role": "assistant", "content": "SELECT T1.user_id, T1.status, COUNT(T2.utxo_id) FROM trading_platform.kyc_audit AS T1 JOIN trading_platform.utxos AS T2 ON T1.user_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.utxos ( utxo_id text, transaction_id text, output_index integer, address text, amount numeric, spent b...
[ { "role": "user", "content": "Get the total payment amount grouped by currency." }, { "role": "assistant", "content": "SELECT currency_code, SUM(amount) AS total_amount\nFROM hospitality_technology.payments\nGROUP BY currency_code;" }, { "role": "user", "content": "Now show only thos...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ...
[ { "role": "user", "content": "Get name pairs of achievements for each game where one is hidden and the other is visible." }, { "role": "assistant", "content": "SELECT a.achievement_id AS hidden_achievement_id, a.name AS hidden_name, b.achievement_id AS visible_achievement_id, b.name AS visible_n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id uuid, game_id uuid, name text, description text, icon_url text, points ...
[ { "role": "user", "content": "Show me all transactions that occurred in the last week." }, { "role": "assistant", "content": "SELECT * FROM web3.transactions WHERE timestamp >= NOW() - INTERVAL '7 days';" }, { "role": "user", "content": "From that list, only show the ones with a stat...
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 web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.n...
[ { "role": "user", "content": "List all posts along with the hashtag IDs applied to them and the usernames of the authors." }, { "role": "assistant", "content": "SELECT p.post_id, ph.hashtag_id, u.username\nFROM social_media.posts p\nJOIN social_media.post_hashtags ph ON p.post_id = ph.post_id\nJ...
You are an SQL statement expert. Given the table 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": "Give me the number of achievements unlocked each day, returning unlock_date and unlock_count." }, { "role": "assistant", "content": "SELECT date_trunc('day', unlocked_at)::date AS unlock_date,\n COUNT(*) AS unlock_count\nFROM gaming_technology.player_achieveme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N...
[ { "role": "user", "content": "Count the number of locations for each state or province and display the state and the count." }, { "role": "assistant", "content": "SELECT state_province, COUNT(*) AS location_count FROM transportation.locations GROUP BY state_province;" }, { "role": "user"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro...
[ { "role": "user", "content": "I need to list each user’s ID, email, and the total amount they've sent in transactions." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, COALESCE(SUM(t.amount), 0) AS total_sent\nFROM blockchain.users u\nJOIN blockchain.wallets w ON u.user_id = w.u...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri...
[ { "role": "user", "content": "Find reviews that contain the word 'dirty' in the comment section, showing the review ID, comment, and rating." }, { "role": "assistant", "content": "SELECT review_id, comment, rating_overall FROM hospitality_technology.reviews WHERE LOWER(comment) LIKE '%dirty%';" ...
You are an SQL statement expert. Given the table 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.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i...
[ { "role": "user", "content": "Can you list each in-game item type and for each, show the number of players who have items of that type and the total quantity held across all players?" }, { "role": "assistant", "content": "SELECT i.item_type, COUNT(DISTINCT pi.player_id) AS player_count, COALESCE...
You are an SQL statement expert. Given the table 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, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w...
[ { "role": "user", "content": "Show me the top 5 users who have interacted with the most DApps, along with their email addresses and the count of distinct DApps they interacted with." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, COUNT(DISTINCT l.details) AS dapp_count FROM tra...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp ) CREATE TAB...
[ { "role": "user", "content": "Show the reservation ID, property name, and room type name for all reservations with a status of 'Confirmed'." }, { "role": "assistant", "content": "SELECT T1.reservation_id, T2.property_name, T3.type_name FROM hospitality_technology.reservations AS T1 JOIN hospital...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List application IDs that have both documents and payments associated with them." }, { "role": "assistant", "content": "SELECT DISTINCT T1.application_id FROM documents AS T1 JOIN payments AS T2 ON T1.application_id = T2.application_id" }, { "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 government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "role": "user", "content": "List each employee's first and last name along with their manager's first and last name." }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.last_name AS employee_name,\n m.first_name || ' ' || m.last_name AS manager_name\nFROM financial_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 financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "List all token symbols on the 'Ethereum' chain with a Realized Ratio greater than 0.9. Show the symbol and realized ratio." }, { "role": "assistant", "content": "SELECT token_symbol, realized_ratio FROM smart_money_token_performance WHERE chain = 'Ethereum' AND real...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address.text, token_symbol.text, pnl.numeric, net_flow.numeric, avg_cost.numeric,...
[ { "role": "user", "content": "List all agents along with their manager's first and last name for agents whose status is 'active'." }, { "role": "assistant", "content": "SELECT a.agent_id,\n a.first_name AS agent_first_name,\n a.last_name AS agent_last_name,\n m.agent_id AS mana...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l...
[ { "role": "user", "content": "List all claim documents uploaded by users whose role is 'Agent'. Show document ID, file name, and the uploader's user ID." }, { "role": "assistant", "content": "SELECT cd.document_id, cd.file_name, cd.uploaded_by FROM insurance.claim_documents cd JOIN users u ON cd...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "Find the contract ID, address, and deployer address for all contracts that have not emitted any events." }, { "role": "assistant", "content": "SELECT c.contract_id, c.address, c.deployer_address FROM web3.contracts AS c LEFT JOIN web3.events AS e ON c.contract_id = ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "特定の職種の従業員情報を取得したいです。従業員ID、名前、職種、雇用日を表示してください。" }, { "role": "assistant", "content": "db.employees.find(\n { job_title: '<specific_job_title>' },\n { employee_id: 1, first_name: 1, last_name: 1, job_title: 1, hire_date: 1, _id: 0 }\n).sort({ hire_date: -1 })" ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Collection 'assembly_steps'. Document structure: { _id: <ObjectId (or step_id)>, step_id: String,...
[ { "role": "user", "content": "Find all wallets created in the last 30 days along with any tokens they might have deployed, showing the wallet address and token names." }, { "role": "assistant", "content": "SELECT w.address, t.token_name FROM web3.wallets w LEFT JOIN web3.contracts c ON w.address...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "Show me all doctors who have prescribed medications along with the count of prescriptions they've made, ordered by the count in descending order." }, { "role": "assistant", "content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(p.prescription_id) AS prescr...
You are an SQL statement expert. Given the table 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, first_name character varying(100) NOT NULL, last_name ch...
[ { "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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "Show the top 5 properties by average overall review rating." }, { "role": "assistant", "content": "SELECT p.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.properties p\nJOIN hospitality_technology.reviews r\n ON p.property_id = r.pr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me the list of all room numbers and their corresponding guest full names for current reservations (status is 'Occupied' or 'CheckedIn')." }, { "role": "assistant", "content": "SELECT r.room_number, g.first_name || ' ' || g.last_name AS guest_full_name\nFROM hos...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "List the name of each law firm along with the first and last name of its managing partner." }, { "role": "assistant", "content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOIN lawyers AS T2 ON T1.managing_partner_id = T2.lawyer_id" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, -- unique identifier for the law firm firm_...
[ { "role": "user", "content": "List all appointments and all diagnoses made by the *same doctor*. Show the appointment ID, doctor ID, appointment time, and diagnosis ID." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.doctor_id, a.appointment_time, d.diagnosis_id FROM healthcare...
You are an SQL statement expert. Given the table 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.appointments ( appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment ...
[ { "role": "user", "content": "能否帮我查询特定列车(train_id 为 'train_789')上的所有车辆信息,并关联到该列车所在的路线信息?" }, { "role": "assistant", "content": "SMEMBERS train:train_789:cars\nHGETALL car:<car_id> for each car_id in result\nHGETALL train:train_789\nSMEMBERS schedule:sched_1122:bookings\nHGETALL booking:<booking_...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure // Use Hashes to store station details. Key format: station:<station_id> // Example: // HSET stat...
[ { "role": "user", "content": "Show me all NFT holders who own more than 10 of the same token, including the contract address, token ID, and wallet address." }, { "role": "assistant", "content": "SELECT nh.contract_address, nh.token_id, nh.wallet_address, CAST(nh.amount AS decimal) AS token_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 nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.t...
[ { "role": "user", "content": "For each loyalty_program_id, how many unique passengers are enrolled and what is the average fare they have paid?" }, { "role": "assistant", "content": "SELECT\n p.loyalty_program_id,\n COUNT(DISTINCT p.passenger_id) AS passenger_count,\n AVG(b.fare) AS avg_fare\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati...
[ { "role": "user", "content": "List all claim documents along with the beneficiary first and last names and their relationship for policies where a document of type 'MEDICAL_REPORT' exists." }, { "role": "assistant", "content": "SELECT cd.document_id, cd.claim_id, cd.file_name, cd.document_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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Show me all trips along with the vehicle make and the route distance in km." }, { "role": "assistant", "content": "SELECT t.trip_id, v.make, r.distance_km\nFROM transportation.trips t\nJOIN transportation.vehicles v ON t.vehicle_id = v.vehicle_id\nJOIN transportatio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Which states have the highest number of customers? Provide the top 5 states along with their customer counts, ordered by count descending." }, { "role": "assistant", "content": "SELECT\n state,\n COUNT(*) AS customer_count\nFROM insurance.customers\nGROUP BY state...
You are an SQL statement expert. Given the table 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": "Show me the subjects and start times of all appointments for a specific client, along with the assigned lawyer ID." }, { "role": "assistant", "content": "SELECT subject, start_time, lawyer_id FROM legal_services.appointments WHERE client_id = 'CLIENT123';" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.appointments ( appointment_id text PRIMARY KEY, client_id text, lawyer_id text, case_id text, start_time...
[ { "role": "user", "content": "Give me a breakdown of the number of reviews per day for the last 14 days, including the review_date and review count." }, { "role": "assistant", "content": "SELECT DATE(review_date) AS review_day, COUNT(*) AS review_count\nFROM hospitality_technology.reviews\nWHERE...
You are an SQL statement expert. Given the table 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.reviews ( review_id text, property_id text, reservation_id text, guest_id text, rating_overall i...
[ { "role": "user", "content": "Show me all prescriptions made by doctors who have issued diagnoses described as 'Hypertension'. Include the doctor's ID, prescription ID, medication ID, and prescription date." }, { "role": "assistant", "content": "SELECT p.doctor_id, p.prescription_id, p.medicatio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "List the sender_user_id and the total number of messages they have sent that include media attachments, along with the conversation_id." }, { "role": "assistant", "content": "SELECT sender_user_id, conversation_id, COUNT(*) AS media_message_count\nFROM social_media....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.messages ( message_id text PRIMARY KEY, conversation_id text, sender_user_id text, content text, media_url...
[ { "role": "user", "content": "List all doctors who have a hospital affiliation and include their specialty and affiliation ID." }, { "role": "assistant", "content": "SELECT first_name, last_name, specialty, hospital_affiliation_id FROM healthcare.doctors WHERE hospital_affiliation_id IS NOT NULL...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number...
[ { "role": "user", "content": "Get a list of users who have both read and unread notifications. For each user, show their user_id, the count of unread notifications as unread_count, and the count of read notifications as read_count." }, { "role": "assistant", "content": "SELECT unread.user_id, un...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.notifications ( notification_id text PRIMARY KEY, user_id text, message text, sent_at timestamp, read_...
[ { "role": "user", "content": "List the first name, last name, and creation date for all patients added in the last 6 months." }, { "role": "assistant", "content": "SELECT first_name, last_name, created_at FROM healthcare.patients WHERE created_at >= NOW() - INTERVAL '6 months';" }, { "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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List users who commented on posts and the content of the post they commented on. Show commenter username and post content." }, { "role": "assistant", "content": "SELECT T1.username, T2.content FROM social_media.users AS T1 JOIN social_media.comments AS T3 ON T1.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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Retrieve route_number, description, and distance_km for routes that have a distance greater than the average distance of all routes." }, { "role": "assistant", "content": "SELECT route_number, description, distance_km\nFROM transportation.routes\nWHERE distance_km >...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati...
[ { "role": "user", "content": "Can you show me all developers along with the year they were founded and their website, grouped by country?" }, { "role": "assistant", "content": "SELECT country, array_agg(name) AS developers, array_agg(founded_year) AS founded_years, array_agg(website) AS websites...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_year.integer, website.text, created_...
[ { "role": "user", "content": "List all auto loans (loan_id, principal_amount, interest_rate) where the current principal balance is less than 40% of the original principal amount, along with the account_id and the difference between principal_amount and current_principal_balance." }, { "role": "assi...
You are an SQL statement expert. Given the table 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.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo...
[ { "role": "user", "content": "List all developer names and their websites." }, { "role": "assistant", "content": "SELECT name, website FROM gaming_technology.developers;" }, { "role": "user", "content": "Can you only include developers whose website contains '.net'?" }, { "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 gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_year.integer, website.text, created_...
[ { "role": "user", "content": "List all cryptocurrency assets that have been traded more than 100 times." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count FROM trading_platform.assets a JOIN trading_platform.trades t ON a.asset_id = t.ass...
You are an SQL statement expert. Given the table 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 players who have never unlocked any achievements." }, { "role": "assistant", "content": "SELECT p.username\nFROM gaming_technology.players p\nLEFT JOIN gaming_technology.player_achievements pa ON p.player_id = pa.player_id\nWHERE pa.achievement_id 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show me all appointments for doctor 'doctor_100' in June 2024, including the appointment time and the patient ID." }, { "role": "assistant", "content": "SELECT appointment_id, patient_id, appointment_time\nFROM healthcare.appointments\nWHERE doctor_id = 'doctor_100'...
You are an SQL statement expert. Given the table 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.appointments ( appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment ...
[ { "role": "user", "content": "Show me the user_id and number of conversations they have joined. Only include users who joined more than one conversation." }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT conversation_id) AS conversations_joined\nFROM social_media.conversation...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text ) CREATE TABLE social_media.conversati...
[ { "role": "user", "content": "List all employees hired in 2023 along with their job title and email." }, { "role": "assistant", "content": "SELECT employee_id, first_name, last_name, job_title, email\nFROM financial_services.employees\nWHERE EXTRACT(YEAR FROM hire_date) = 2023;" }, { "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 financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "Show me all bookings with a status of 'confirmed' that were made in the last 7 days, including passenger_id and fare." }, { "role": "assistant", "content": "SELECT b.booking_id, b.passenger_id, b.fare FROM transportation.bookings b WHERE b.status = 'confirmed' AND b...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "Retrieve all beneficiaries with their policy numbers, including beneficiary first and last name, relationship, and the policy end date." }, { "role": "assistant", "content": "SELECT pb.beneficiary_id, pb.first_name, pb.last_name, pb.relationship, p.policy_number, 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 insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "Show me the full name of guests who have left reviews along with the overall rating they gave." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, r.rating_overall FROM hospitality_technology.reviews r JOIN hospitality_technology.guests g ON r.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 hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, -- unique identifier for the room ...
[ { "role": "user", "content": "List the diagnosis code, description, and insurance provider for all diagnoses where the code type is 'ICD-9'." }, { "role": "assistant", "content": "SELECT d.diagnosis_code, d.description, ip.insurance_provider\nFROM healthcare.diagnoses d\nJOIN healthcare.insuranc...
You are an SQL statement expert. Given the table 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": "List the first name and last name of citizens who have uploaded documents that are still valid, together with the type of document and the upload timestamp." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, d.document_type, d.upload_timestamp\...
You are an SQL statement expert. Given the table 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 me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address, from the nft_holders table." }, { "role": "assistant", "content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE 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 erc1155_approval_for_all ( block_number.bigint, block_timestamp.timestamp, transaction_index.integer, transaction_hash....
[ { "role": "user", "content": "List tokens with a market cap greater than $500,000,000 and a trend rank of 10 or better. Show symbol, name, chain, market cap, and trend rank." }, { "role": "assistant", "content": "SELECT token_symbol, token_name, chain, market_cap, trend_rank FROM token_basic_inf...
You are an SQL statement expert. Given the table 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.text, token_name.text, token_symbol.text, token_address.text, chain.text, price.numeric, pri...
[ { "role": "user", "content": "Show me the usernames and email addresses of users who commented on any post tagged with the hashtag 'H777'." }, { "role": "assistant", "content": "SELECT DISTINCT u.username, u.email\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = u.user_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": "Show me all properties in California with a star rating above 4.0, along with the count of active staff members at each property." }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, p.star_rating, COUNT(s.staff_id) AS active_staff_count FRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Show the number of users registered each month for 2024." }, { "role": "assistant", "content": "SELECT\n date_trunc('month', created_at) AS month,\n COUNT(*) AS user_count\nFROM trading_platform.users\nWHERE created_at >= '2024-01-01'\n AND created_at < '2025-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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "Show all doctors created before January 1st, 2023, listing their ID, first name, and last name." }, { "role": "assistant", "content": "SELECT\n doctor_id,\n first_name,\n last_name\nFROM\n healthcare.doctors\nWHERE\n created_at < '2023-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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "List pairs of securities that trade on different exchanges but belong to the same sector, showing ticker_symbol of both as symbol_a and symbol_b, their exchanges, and the sector." }, { "role": "assistant", "content": "SELECT a.ticker_symbol AS symbol_a, a.exchange 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 financial_services.securities ( security_id character varying(64) NOT NULL, -- unique identifier for the security ...
[ { "role": "user", "content": "List all patients with active chronic diagnoses, including their diagnosis descriptions and dates." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, d.description, d.diagnosis_date FROM healthcare.patients p JOIN healthcare.diagn...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Find all medical records where the vitals field indicates a heart rate over 100 bpm, along with the associated appointment details and diagnosis description if available." }, { "role": "assistant", "content": "SELECT mr.record_id, mr.patient_id, a.appointment_time, ...
You are an SQL statement expert. Given the table 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.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "Show me a list of users who have received notifications of type 'mention', along with their usernames and the notification creation time." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, n.notification_id, n.created_at\nFROM social_media.users u\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Show me the list of posts with their content and the usernames of users who commented on them, for posts that are public." }, { "role": "assistant", "content": "SELECT p.post_id, p.content, u.username AS commenter_username\nFROM social_media.posts p\nJOIN social_med...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t...
[ { "role": "user", "content": "Show me the number of unique achievements unlocked by each player." }, { "role": "assistant", "content": "SELECT player_id, COUNT(DISTINCT achievement_id) AS unique_achievements_unlocked\nFROM gaming_technology.player_achievements\nGROUP BY player_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 gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti...
[ { "role": "user", "content": "List the citizen_id, first_name, last_name, and registration_date for all citizens who registered during March 2024." }, { "role": "assistant", "content": "SELECT citizen_id, first_name, last_name, registration_date\nFROM government_services.citizens\nWHERE registra...
You are an SQL statement expert. Given the table 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": "How many unique wallet addresses are there per user_id?" }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT address_id) as wallet_count FROM blockchain.wallets GROUP BY user_id;" }, { "role": "user", "content": "Filter this to only show...
You are an SQL statement expert. Given the table 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": "Show me the top 10 tokens based on their 24-hour trading volume. Include the token symbol and volume." }, { "role": "assistant", "content": "SELECT token_symbol, volume_24h FROM token_dexpool_info ORDER BY volume_24h DESC LIMIT 10;" }, { "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 token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "For each vehicle, find the vehicle acquired immediately before it in the same depot. Show current vehicle_id, acquisition_date, previous_vehicle_id, and previous_acquisition_date." }, { "role": "assistant", "content": "SELECT v.vehicle_id,\n v.acquisition_date...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "For each employee who has verified more than one document, list their employee ID, the first document they verified, and the next document they verified, along with both verification timestamps." }, { "role": "assistant", "content": "SELECT\n d1.verified_by_employe...
You are an SQL statement expert. Given the table 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": "How many tokens are there for each unique token symbol?" }, { "role": "assistant", "content": "SELECT token_symbol, COUNT(*) AS token_count FROM web3.tokens GROUP BY token_symbol;" }, { "role": "user", "content": "Now, only show symbols that have more 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 web3.tokens ( token_id character varying(64) NOT NULL, contract_address character varying(128) NOT NULL, token_name cha...
[ { "role": "user", "content": "How many medications does each manufacturer have?" }, { "role": "assistant", "content": "SELECT manufacturer, COUNT(*) AS med_count\nFROM healthcare.medications\nGROUP BY manufacturer;" }, { "role": "user", "content": "Only include manufacturers with mor...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,...
[ { "role": "user", "content": "I would like to list each appointment along with any associated medical record's chief complaint, including the appointment_id, appointment_time, and chief_complaint. Include appointments even if there's no medical record." }, { "role": "assistant", "content": "SELE...
You are an SQL statement expert. Given the table 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, first_name character varying(100) NOT NULL, last_name ch...
[ { "role": "user", "content": "Give a list of all policies where the deductible is less than 1000. Show policy_id, policy_number, start_date, and deductible." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, start_date, deductible\nFROM insurance.policies\nWHERE deductible <...
You are an SQL statement expert. Given the table 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 pairs of bookings made for the same trip, showing booking IDs and their booking_time." }, { "role": "assistant", "content": "SELECT b1.booking_id AS booking1,\n b2.booking_id AS booking2,\n b1.trip_id,\n b1.booking_time AS time1,\n b2.bo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, s...
[ { "role": "user", "content": "I want the case number, case name, the client's full name, and the lead lawyer's full name for all cases." }, { "role": "assistant", "content": "SELECT cs.case_number,\n cs.case_name,\n cl.first_name || ' ' || cl.last_name AS client_full_name,\n lw...
You are an SQL statement expert. Given the table 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": "Find all patients who have been prescribed medications (mentioned in appointment notes) along with their doctors' names and the medication details mentioned." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, d.first_name AS docto...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show me all medications where the description field is not provided (either NULL or empty)." }, { "role": "assistant", "content": "SELECT medication_id, medication_name, manufacturer FROM healthcare.medications WHERE description IS NULL OR description = '';" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, -- unique identifier for the medication type...
[ { "role": "user", "content": "List all premium payments made by customer 'CUST001' in the year 2024. Show payment ID, policy ID, amount paid, and payment date." }, { "role": "assistant", "content": "SELECT payment_id, policy_id, amount_paid, payment_date FROM insurance.premium_payments WHERE cus...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment po...
[ { "role": "user", "content": "Show all SUI coins with 'exists' status and more than 8 decimal places. Display coin_type, symbol, name, and decimals." }, { "role": "assistant", "content": "SELECT coin_type, symbol, name, decimals\nFROM sui_coins_metadata\nWHERE status = 'exists' AND decimals > 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 nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_i...