conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "How many prescriptions exist for each medication? Show medication name and total prescriptions, sorted by total descending." }, { "role": "assistant", "content": "SELECT m.medication_name, COUNT(p.prescription_id) AS total_prescriptions FROM healthcare.prescriptions...
You are an SQL statement expert. Given the table 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": "What is the total amount invoiced per status?" }, { "role": "assistant", "content": "SELECT status,\n SUM(total_amount) AS total_invoiced\nFROM legal_services.invoices\nGROUP BY status;" }, { "role": "user", "content": "Only include statuses 'Paid'...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the invoice invo...
[ { "role": "user", "content": "List all transactions where the recipient address is not specified (i.e., to_address is NULL), showing transaction_id, from_address, value, and block_number." }, { "role": "assistant", "content": "SELECT transaction_id, from_address, value, block_number\nFROM web3.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 web3.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction fr...
[ { "role": "user", "content": "Which employees have scheduled appointments with citizens whose account has not been verified? Please show the employee's first name, last name, and number of such appointments." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, COUNT(a.appoint...
You are an SQL statement expert. Given the table 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 total transfer volume and number of transfers for each token tick on Bitcoin in the past 7 days." }, { "role": "assistant", "content": "SELECT tick, SUM(amt) AS total_volume, COUNT(*) AS transfer_count\nFROM token_activities_bitcoin\nWHERE block_timestam...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "List all CEX addresses on the BSC chain that hold more than $1 million USD value in total." }, { "role": "assistant", "content": "SELECT address, SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE chain = 'BSC' GROUP BY address HAVING SUM(usd_value) > 10...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE cex_token_balance (", "snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ...
[ { "role": "user", "content": "Show the sender user ID, notification type, and creation time for all notifications sent by users who have email notifications enabled." }, { "role": "assistant", "content": "SELECT n.sender_user_id, n.notification_type, n.created_at FROM social_media.notifications ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.hashtags ( hashtag_id.text, tag_name.text, created_at.timestamp ) CREATE TABLE social_media.notifications ...
[ { "role": "user", "content": "Show me the usernames along with the names of group chats they are participating in and the dates they joined each group." }, { "role": "assistant", "content": "SELECT u.username, c.group_name, cp.joined_at\nFROM social_media.conversation_participants cp\nJOIN socia...
You are an SQL statement expert. Given the table 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 rooms by current_condition." }, { "role": "assistant", "content": "SELECT current_condition, COUNT(*) AS room_count FROM hospitality_technology.rooms GROUP BY current_condition;" }, { "role": "user", "content": "Actually, only inclu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room...
[ { "role": "user", "content": "Show each player’s username, the number of achievements they have unlocked, and the total quantity of items they currently have in their inventory." }, { "role": "assistant", "content": "SELECT p.username,\n COUNT(DISTINCT pa.achievement_id) AS achievements_co...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Show me the document ID, file name, document type, and the status of the claim it belongs to, for all documents uploaded by agents whose license state is 'NY'." }, { "role": "assistant", "content": "SELECT cd.document_id, cd.file_name, cd.document_type, c.status 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 insurance.claim_documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "Show the case number, case name, and the full name of the lead lawyer, along with the total hours spent on each case." }, { "role": "assistant", "content": "SELECT c.case_number, c.case_name, CONCAT(l.first_name, ' ', l.last_name) AS lead_lawyer_name, COALESCE(SUM(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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "role": "user", "content": "Find all law firms that share the same address, listing each address and the two firm names." }, { "role": "assistant", "content": "SELECT f1.address, f1.firm_name AS firm1, f2.firm_name AS firm2 FROM law_firms f1 JOIN law_firms f2 ON f1.address = f2.address AND f1....
You are an SQL statement expert. Given the table 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, firm_name character varying(200) NOT NULL, address t...
[ { "role": "user", "content": "Show me the usernames and group names for all users who received a 'mention' notification related to group conversations, and when those notifications were created." }, { "role": "assistant", "content": "SELECT us.user_id, us.theme AS username, c.group_name, n.creat...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, user_id char...
[ { "role": "user", "content": "Show the name and type of all locations. Also include the country." }, { "role": "assistant", "content": "SELECT name, type, country FROM transportation.locations;" }, { "role": "user", "content": "Now, only show locations located in France and order the...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Show the first name, last name, and job title for all employees working for agencies with a jurisdiction level of 'State'." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, e.job_title FROM government_services.employees e JOIN government_servi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e...
[ { "role": "user", "content": "Find all chronic diagnoses made by Cardiology doctors in the last year, including patient ID, diagnosis description, and doctor's full name." }, { "role": "assistant", "content": "SELECT di.patient_id, di.description, d.first_name || ' ' || d.last_name AS doctor_nam...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ...
[ { "role": "user", "content": "Show me the top 5 NFT collections with the highest number of unique owners, along with their names and contract addresses." }, { "role": "assistant", "content": "SELECT nc.name, nc.contract_address, COUNT(DISTINCT nh.wallet_address) AS unique_owners FROM nft_collect...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Show the usernames and registration dates of all players whose last_login is NULL." }, { "role": "assistant", "content": "SELECT username, registration_date FROM gaming_technology.players WHERE last_login IS NULL;" }, { "role": "user", "content": "Please...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "For each claim, list the incident date, the policy number, and the number of beneficiaries associated with that policy." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, p.policy_number, COUNT(pb.beneficiary_id) AS beneficiary_count\nFROM in...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "List all agents who have a commission rate above 0.1 and show their full names and agency names." }, { "role": "assistant", "content": "SELECT agent_id, first_name || ' ' || last_name AS full_name, agency_name, commission_rate FROM insurance.agents WHERE commission_...
You are an SQL statement expert. Given the table 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": "How many patients are there in each gender category?" }, { "role": "assistant", "content": "SELECT gender,\n COUNT(*) AS patient_count\nFROM healthcare.patients\nGROUP BY gender;" }, { "role": "user", "content": "Limit this to categories with more ...
You are an SQL statement expert. Given the table 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": "List for each fuel type the number of unique vehicle models available. Show the fuel_type and the model count." }, { "role": "assistant", "content": "SELECT fuel_type, COUNT(DISTINCT model) AS model_count FROM transportation.vehicles GROUP BY fuel_type ORDER BY fuel...
You are an SQL statement expert. Given the table 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 all DApps whose name starts with the letter 'C'." }, { "role": "assistant", "content": "SELECT * FROM trading_platform.dapps WHERE name ILIKE 'C%';" }, { "role": "user", "content": "Could you instead make it case-sensitive so only names that start w...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.dapps ( dapp_id.text, name.text, description.text, url.text )
[ { "role": "user", "content": "What is the total USD value of all token outflows (type = 2) across all chains?" }, { "role": "assistant", "content": "SELECT SUM(usd_value) AS total_outflow_usd FROM smart_money_token_inflow WHERE type = 2;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character...
[ { "role": "user", "content": "Find all blocks where the difficulty is between 1000 and 2000." }, { "role": "assistant", "content": "SELECT block_id, timestamp, difficulty FROM blockchain.blocks WHERE difficulty BETWEEN 1000 AND 2000;" }, { "role": "user", "content": "Now filter these...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, -- unique identifier for the block previous_block...
[ { "role": "user", "content": "List all tokens with their contract addresses and total supply, sorted by total supply in descending order." }, { "role": "assistant", "content": "SELECT token_name, contract_address, total_supply FROM web3.tokens ORDER BY total_supply DESC;" }, { "role": "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 web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "I need a list of active drivers with their names and contact details." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, contact_number, email FROM transportation.drivers WHERE status = 'Active';" }, { "role": "user", "conten...
You are an SQL statement expert. Given the table 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": "I need to find pairs of clients who work for the same company, showing each pair's full names and the company name." }, { "role": "assistant", "content": "SELECT c1.company_name, CONCAT(c1.first_name, ' ', c1.last_name) AS client1_name, CONCAT(c2.first_name, ' ', c2...
You are an SQL statement expert. Given the table 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 all transfer activities for the token tick 'PEPE', including the sender, receiver, and amount." }, { "role": "assistant", "content": "SELECT from_address, to_address, amt FROM token_activities WHERE tick = 'PEPE' AND type = 'transfer'" }, { "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 erc20_balances ( block_number bigint, contract_address text, wallet_address text, amount text, pk text ) CREATE TABLE n...
[ { "role": "user", "content": "Show me the full names and specialties of all doctors who have issued a prescription for a patient enrolled in an insurance plan provided by 'Global Health'." }, { "role": "assistant", "content": "SELECT DISTINCT d.first_name, d.last_name, d.specialty\nFROM healthca...
You are an SQL statement expert. Given the table 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": "Calculate the average total amount and average amount paid for reservations grouped by booking source." }, { "role": "assistant", "content": "SELECT booking_source, AVG(total_amount) AS avg_total_amount, AVG(amount_paid) AS avg_amount_paid FROM hospitality_technolog...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ...
[ { "role": "user", "content": "I want a list of game_id and the count of hidden achievements for each game." }, { "role": "assistant", "content": "SELECT game_id, COUNT(*) AS hidden_achievement_count\nFROM gaming_technology.achievements\nWHERE hidden = TRUE\nGROUP BY game_id;" }, { "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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "List all ERC20 tokens where the price is greater than $100, including their names and symbols." }, { "role": "assistant", "content": "SELECT ti.name, ti.symbol FROM token_info ti JOIN token_prices tp ON ti.tick = tp.symbol WHERE tp.price > 100;" }, { "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 erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "Find appointments that are longer than 30 minutes." }, { "role": "assistant", "content": "SELECT * FROM legal_services.appointments WHERE end_time IS NOT NULL AND start_time IS NOT NULL AND end_time > start_time + INTERVAL '30 minutes'" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "Retrieve, for each room type, the total number of services offered by its property, including the property_name, type_name, and service_count." }, { "role": "assistant", "content": "SELECT p.property_name,\n rt.type_name,\n COUNT(s.service_id) AS service...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Count how many doctors have an email address ending with '.com'." }, { "role": "assistant", "content": "SELECT count(*) FROM healthcare.doctors WHERE email LIKE '%.com';" } ]
You are an SQL statement expert. Given the table 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 the location name and city for all service locations that belong to agencies which offer services with a standard fee greater than 500. Include the service name and fee." }, { "role": "assistant", "content": "SELECT DISTINCT T2.location_name, T2.city, T1.servic...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, -- unique identifier for the service ...
[ { "role": "user", "content": "What is the total and average amount of unspent UTXOs per address?" }, { "role": "assistant", "content": "SELECT\n address,\n COUNT(*) AS utxo_count,\n SUM(amount) AS total_unspent_amount,\n AVG(amount) AS average_unspent_amount\nFROM trading_platform.utxos\nWHE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "For all NFT collections on the Ethereum blockchain, show me the collection name and the current floor price. Sort by floor price descending." }, { "role": "assistant", "content": "SELECT name, floor_price FROM nft_collections WHERE blockchain = 'Ethereum' ORDER BY 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "List all game titles and the count of online servers hosting each game." }, { "role": "assistant", "content": "SELECT T1.title, count(T2.server_id) FROM games AS T1 JOIN servers AS T2 ON T1.game_id = T2.game_id WHERE T2.status = 'online' GROUP BY T1.title;" }, {...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Show me all PDF claim documents that were uploaded after March 1st, 2024, and the usernames of those who uploaded them, along with the related claim ID." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name, uploaded_by FROM insurance.claim_...
You are an SQL statement expert. Given the table 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": "Show me the count of events for each event_name emitted by contracts starting with '0x1234'." }, { "role": "assistant", "content": "SELECT event_name, COUNT(*) as event_count FROM web3.events WHERE contract_id LIKE '0x1234%' GROUP BY event_name;" }, { "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 web3.events ( event_id text PRIMARY KEY, contract_id text, event_name text, data text, emitted_at timestamp, transactio...
[ { "role": "user", "content": "Show me all guests from 'CA' along with their full name and email address." }, { "role": "assistant", "content": "SELECT guest_id, CONCAT(first_name, ' ', last_name) AS full_name, email FROM hospitality_technology.guests WHERE country_code = 'CA';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "Which centralized exchange holds the highest total USD value of tokens in the 'AI' narrative, and what is that amount?" }, { "role": "assistant", "content": "SELECT cb.exchange, SUM(cb.usd_value) AS total_usd_value\nFROM cex_token_balance cb\nJOIN smart_money_token_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE narrative_info (", "narrative character varying(512) NOT NULL, -- the id of narrative", "top_3_coins text, --...
[ { "role": "user", "content": "Find pairs of servers in the same region where one server's current_players is more than twice that of another. Return the region, server1 name, server2 name, and their current_players counts." }, { "role": "assistant", "content": "SELECT s1.region,\n s1.serve...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,...
[ { "role": "user", "content": "List all pairs of locations that are in the same city. Include their names and the city they are in." }, { "role": "assistant", "content": "SELECT\n l1.name AS location1_name,\n l2.name AS location2_name,\n l1.city\nFROM transportation.locations AS l1\nJOIN trans...
You are an SQL statement expert. Given the table 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, name.text, type.text, address_line1.text, city.text, state_province.text, ...
[ { "role": "user", "content": "List all claims that are still pending (status = 'pending') and were reported more than 30 days ago." }, { "role": "assistant", "content": "SELECT claim_id, policy_id, customer_id, reported_date FROM insurance.claims WHERE status = 'pending' AND reported_date < CURR...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "Provide a count of how many peers were last seen on each distinct day recorded in the system." }, { "role": "assistant", "content": "SELECT DATE(last_seen), COUNT(*) FROM trading_platform.peers GROUP BY DATE(last_seen) ORDER BY DATE(last_seen);" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp ) CREATE TAB...
[ { "role": "user", "content": "Show me the total transaction amount sent by each user (based on user_id) in the last 30 days, along with their username." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, SUM(t.amount) AS total_amount_sent FROM blockchain.users u JOIN blockchain....
You are an SQL statement expert. Given the table 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": "Which staff members ordered more than 5 service orders in total? List their staff_id, full name, and the total number of orders they've placed." }, { "role": "assistant", "content": "SELECT s.staff_id, s.first_name, s.last_name, COUNT(so.order_id) AS total_orders\nF...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "Show me all unique bed types available across different properties along with their base rates." }, { "role": "assistant", "content": "SELECT DISTINCT bed_type, base_rate, property_id FROM hospitality_technology.room_types;" }, { "role": "user", "content...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu...
[ { "role": "user", "content": "Show a list of all documents, along with the case name and the email of the client related to each document." }, { "role": "assistant", "content": "SELECT d.document_name, c.case_name, cl.email\nFROM legal_services.documents d\nJOIN legal_services.cases c ON d.case_...
You are an SQL statement expert. Given the table 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, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad...
[ { "role": "user", "content": "List all cancelled policies with their cancellation reasons and premium amounts." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, cancellation_reason, premium_amount FROM insurance.policies WHERE status = 'Cancelled';" }, { "role": "us...
You are an SQL statement expert. Given the table 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, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "List the top 5 tokens by net_flow, showing token_symbol, net_flow, pnl, and price." }, { "role": "assistant", "content": "SELECT token_symbol,\n net_flow,\n pnl,\n price\nFROM smart_money_token_performance\nORDER BY net_flow DESC\nLIMIT 5;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address.text, token_symbol.text, pnl.numeric, net_flow.numeric, avg_cost.numeric,...
[ { "role": "user", "content": "List all clients with the count of cases they have opened." }, { "role": "assistant", "content": "SELECT\n c.client_id,\n c.first_name,\n c.last_name,\n COUNT(cs.case_id) AS case_count\nFROM legal_services.clients c\nLEFT JOIN legal_services.cases cs ON c.client...
You are an SQL statement expert. Given the table 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": "List all group chats with their conversation ID, group_name, and the total number of likes that occurred after the chat was created." }, { "role": "assistant", "content": "SELECT c.conversation_id,\n c.group_name,\n COUNT(l.like_id) AS total_likes\nFROM ...
You are an SQL statement expert. Given the table 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": "How many available rooms and available services are there for each property?" }, { "role": "assistant", "content": "SELECT\n r.property_id,\n SUM(CASE WHEN r.status = 'Available' THEN 1 ELSE 0 END) AS available_rooms_count,\n SUM(CASE WHEN s.is_available = TRUE 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.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "Find all vehicles that share the same make and model but were manufactured in different years. Show both vehicle IDs, the make, model, and their respective years." }, { "role": "assistant", "content": "SELECT v1.vehicle_id AS vehicle1_id,\n v2.vehicle_id AS ve...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "List all rooms that are currently available (status = 'available') and have a non-smoking policy, along with their room numbers and features." }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number, features FROM hospitality_technology.rooms ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List all tokens from the token_dexpool_info table with a liquidity over $10 million and a positive 6-hour price change percentage on the Ethereum chain." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, liquidity, price_change_percentage_6h 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 narrative_info (", "narrative character varying(512) NOT NULL, -- the id of narrative", "top_3_coins text, --...
[ { "role": "user", "content": "Show the names and types of all assets whose symbol is exactly 3 characters long." }, { "role": "assistant", "content": "SELECT name, type, symbol FROM trading_platform.assets WHERE LENGTH(symbol) = 3;" }, { "role": "user", "content": "Also, I want to or...
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, name text, symbol text, type text )
[ { "role": "user", "content": "Show me pairs of passengers who share the same loyalty program, including their IDs, first and last names, and the loyalty_program_id." }, { "role": "assistant", "content": "SELECT p1.passenger_id AS passenger1_id, p1.first_name AS first1, p1.last_name AS last1, p2....
You are an SQL statement expert. Given the table 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.passengers ( passenger_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "For each Avalanche token tick, show me the creator from the `token_info_avalanche` table and the total number of activities recorded for that tick in the `token_activities` table." }, { "role": "assistant", "content": "SELECT ti.tick, ti.creator, COUNT(ta.tx_hash) 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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "List the sent notifications related to appointments, including notification ID, message subject, citizen full name, and scheduled start time of the appointment." }, { "role": "assistant", "content": "SELECT\n n.notification_id,\n n.message_subject,\n c.first_name...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Show me all comments that are replies to other comments, along with the ID of the parent comment and the post ID." }, { "role": "assistant", "content": "SELECT comment_id, parent_comment_id, post_id\nFROM social_media.comments\nWHERE parent_comment_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 social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "I need a report listing each customer’s full name, the number of accounts they hold, and the date when they opened their first account." }, { "role": "assistant", "content": "SELECT c.customer_id,\n c.first_name || ' ' || c.last_name AS full_name,\n COUN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "List each wallet with its wallet_id, user_id, and the total amount of unspent UTXOs associated with that wallet." }, { "role": "assistant", "content": "SELECT\n w.wallet_id,\n w.user_id,\n COALESCE(SUM(u.amount), 0) AS unspent_total\nFROM trading_platform.wallets...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "Show me the total principal_amount of all loans for each loan_type." }, { "role": "assistant", "content": "SELECT loan_type, SUM(principal_amount) AS total_principal\nFROM financial_services.loans\nGROUP BY loan_type;" }, { "role": "user", "content": "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 financial_services.accounts ( account_id.text, customer_id.text, account_number.text, account_type.text, balance.numeri...
[ { "role": "user", "content": "List all patients born in the 1980s, including their full names and genders." }, { "role": "assistant", "content": "SELECT CONCAT(first_name, ' ', last_name) AS full_name, gender FROM healthcare.patients WHERE date_of_birth BETWEEN '1980-01-01' AND '1989-12-31';" ...
You are an SQL statement expert. Given the table 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": "For each transaction, find the next transaction initiated by the same sender. List the original transaction_id, the next transaction_id, the sender address, and the time difference in hours between them." }, { "role": "assistant", "content": "SELECT t1.transaction_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 web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price...
[ { "role": "user", "content": "Could you produce a summary report listing each security's ticker_symbol, exchange, average close_price, and average volume based on market_data?" }, { "role": "assistant", "content": "SELECT s.ticker_symbol, s.exchange, AVG(m.close_price) AS avg_close_price, AVG(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 financial_services.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N...
[ { "role": "user", "content": "List all terminated agents who worked for more than 5 years, showing their full names and termination dates." }, { "role": "assistant", "content": "SELECT first_name, last_name, termination_date FROM insurance.agents WHERE termination_date IS NOT NULL AND (terminati...
You are an SQL statement expert. Given the table 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": "Show me all in-game items of type 'Weapon' along with the server names where the games they belong to are currently online." }, { "role": "assistant", "content": "SELECT i.item_id, i.item_name, g.title, s.server_name\nFROM gaming_technology.in_game_items i\nJOIN gam...
You are an SQL statement expert. Given the table 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, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "Show me a list of active Sui NFTs with their object ID, name, and owner." }, { "role": "assistant", "content": "SELECT object_id, name, owner FROM sui_nfts WHERE status = 'exists';" }, { "role": "user", "content": "Please include the collection type and ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Provide a count of notifications grouped by their related entity type." }, { "role": "assistant", "content": "SELECT related_entity_type, COUNT(*) FROM government_services.notifications GROUP BY related_entity_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 government_services.notifications ( notification_id text, citizen_id text, application_id text, message_subject text, m...
[ { "role": "user", "content": "List the usernames and emails of users who have set a location in their profile." }, { "role": "assistant", "content": "SELECT username, email\nFROM social_media.users\nWHERE location IS NOT NULL AND 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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "How many active insurance policies are there for each plan_id? Show plan_id and active_count." }, { "role": "assistant", "content": "SELECT plan_id,\n COUNT(*) AS active_count\nFROM healthcare.patient_insurance\nWHERE expiration_date IS NULL OR expiration_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 healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb...
[ { "role": "user", "content": "Find pairs of cases that belong to the same client, listing the case number, case name, and the shared client ID for each pair." }, { "role": "assistant", "content": "SELECT c1.case_number AS case_number_1, c1.case_name AS case_name_1, c2.case_number AS case_number_...
You are an SQL statement expert. Given the table 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": "Which chain has the highest total USD inflow from buy transactions (type=1), and how many distinct tokens were involved in that inflow?" }, { "role": "assistant", "content": "SELECT chain, SUM(usd_value) AS total_inflow, COUNT(DISTINCT token_symbol) AS distinct_toke...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_inflow ( token_address text, token_symbol text, token_amount numeric, usd_value numeric, avg_price nu...
[ { "role": "user", "content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a daily trading volume exceeding 1 million shares, along with the employee details (employee_id, first_name, last_name) who last updated these securities." }, { ...
You are an SQL statement expert. Given the table 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, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "What is the maintenance schedule for the platforms at the station with ID 'ST234' for the next month?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to the maintenance schedule for the platforms at any station. The data I have only include...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.s...
[ { "role": "user", "content": "Show the document ID, document type, and upload timestamp for all documents uploaded by citizens who registered after January 1st, 2023." }, { "role": "assistant", "content": "SELECT d.document_id, d.document_type, d.upload_timestamp FROM government_services.documen...
You are an SQL statement expert. Given the table 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 text, application_id text, citizen_id text, document_type text, file_refere...
[ { "role": "user", "content": "List all pairs of customers who live in the same zip_code. Show customer1_id, customer2_id, and zip_code." }, { "role": "assistant", "content": "SELECT\n c1.customer_id AS customer1_id,\n c2.customer_id AS customer2_id,\n c1.zip_code\nFROM insurance.customers c1\...
You are an SQL statement expert. Given the table 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": "Provide the count of drivers for each status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS driver_count\nFROM transportation.drivers\nGROUP BY status;" }, { "role": "user", "content": "Only include statuses with more than 5 drivers a...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens...
[ { "role": "user", "content": "For each customer, provide a summary of their account statuses, showing their full name, account status, and the count of accounts for each status." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.status, COUNT(a.account_id) AS account_coun...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "List the node ID, IP address, and port for all nodes last seen after '2024-06-01'." }, { "role": "assistant", "content": "SELECT node_id, ip_address, port FROM blockchain.nodes WHERE last_seen > '2024-06-01';" }, { "role": "user", "content": "How many no...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, r...
[ { "role": "user", "content": "Show me the usernames of users who have posted a comment on a post that includes the hashtag 'nature', along with the content of the comment." }, { "role": "assistant", "content": "SELECT DISTINCT u.username, c.content\nFROM social_media.comments c\nJOIN social_medi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "List all pairs of events that occurred within the same transaction but were emitted by different contracts. Show the transaction ID, the IDs and names of both events, and the IDs of the contracts that emitted 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 web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for the event contract_id characte...
[ { "role": "user", "content": "Show me all prescriptions where the prescribed medication is not manufactured by the same company that produced the generic drug (if different entries share a generic_name). Return prescription_id, medication_id, manufacturer, and generic_name." }, { "role": "assistant"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,...
[ { "role": "user", "content": "List all top-level comments (comments without a parent_comment_id), showing the comment ID and content." }, { "role": "assistant", "content": "SELECT comment_id, content FROM social_media.comments WHERE parent_comment_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 social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "List the record ID, record date, and chief complaint for all medical records created by doctor 'doc_321' for patient 'pat_007'." }, { "role": "assistant", "content": "SELECT record_id, record_date, chief_complaint\nFROM healthcare.medical_records\nWHERE doctor_id = ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "Show me all users who registered with a Gmail email address, along with their registration dates." }, { "role": "assistant", "content": "SELECT user_id, username, email, password_hash FROM blockchain.users WHERE email LIKE '%@gmail.com';" }, { "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 blockchain.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character va...
[ { "role": "user", "content": "Show me for each asset_id, the number of associated metadata entries and the total number of notifications ever sent to users." }, { "role": "assistant", "content": "SELECT m.asset_id, COUNT(m.metadata_id) AS metadata_count, (SELECT COUNT(*) FROM trading_platform.no...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.metadata ( metadata_id text, asset_id text, key text, value text ) CREATE TABLE trading_platform.notif...
[ { "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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "List the wallet IDs and creation timestamps for all wallets created after '2023-01-01'." }, { "role": "assistant", "content": "SELECT wallet_id, created_at FROM web3.wallets WHERE created_at > '2023-01-01';" }, { "role": "user", "content": "Can you modif...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
[ { "role": "user", "content": "For each group conversation, I need its ID, name, and the count of participants whose last_read_at is earlier than the conversation's last_message_at (i.e., participants with unread messages)." }, { "role": "assistant", "content": "SELECT\n c.conversation_id,\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 social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t...
[ { "role": "user", "content": "How many users have disabled push notifications?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS disabled_push_count\nFROM social_media.user_settings\nWHERE push_notifications_enabled = false;" } ]
You are an SQL statement expert. Given the table 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 first and last names of all customers and the agency name of the agent who sold their policy." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.agency_name\nFROM insurance.policies p\nJOIN insurance.customers c ON p.customer_id =...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "Find all patients who have both a primary insurance plan and at least one completed appointment, along with their insurance policy numbers and the count of appointments." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...