conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "List each user along with the total number of public posts they have made, and the names of any hashtags associated with their posts." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(DISTINCT p.post_id) AS public_post_count, STRING_AGG(DIST...
You are an SQL statement expert. Given the table 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 wallet addresses and their creation dates for wallets created in the last 30 days, sorted by creation date in descending order." }, { "role": "assistant", "content": "SELECT address, created_at FROM web3.wallets WHERE created_at >= NOW() - INTERVAL '30 d...
You are an SQL statement expert. Given the table 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 trade, show the buyer_id, seller_id, asset_id, quantity, and also include any metadata value where the key is 'exchange' for the asset involved." }, { "role": "assistant", "content": "SELECT t.buyer_id, t.seller_id, t.asset_id, t.quantity, m.value AS exchan...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.trades ( trade_id text, order_id text, buyer_id text, seller_id text, asset_id text, quantity numeric,...
[ { "role": "user", "content": "Show all active agents along with their respective managers' full names." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name || ' ' || a.last_name AS agent_name, m.first_name || ' ' || m.last_name AS manager_name FROM insurance.agents a LEFT JOIN ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name chara...
[ { "role": "user", "content": "List all active agents along with their license_state and the full name of their manager." }, { "role": "assistant", "content": "SELECT a.agent_id,\n a.first_name,\n a.last_name,\n a.license_state,\n m.first_name || ' ' || m.last_name AS mana...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "Count the number of patients grouped by gender, showing gender and patient_count." }, { "role": "assistant", "content": "SELECT gender, COUNT(*) AS patient_count\nFROM healthcare.patients\nGROUP BY gender;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List all tokens with a price below $1 and a 24-hour trading volume over $10 million." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE price < 1 AND CAST(total_volume AS double precision) > 100000...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol ch...
[ { "role": "user", "content": "Which DEX tokens currently have a negative price change over the last hour and a trading volume above $100,000?" }, { "role": "assistant", "content": "SELECT token_name, token_symbol, chain, price_change_percentage_1h, volume_24h\nFROM token_dexpool_info\nWHERE pric...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "What is the total payment amount for each currency recorded in the payments table?" }, { "role": "assistant", "content": "SELECT currency , sum(amount) FROM government_services.payments GROUP BY currency" }, { "role": "user", "content": "Now, 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "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": "Show me all intercity routes with their origin and destination cities, along with the average passenger count for completed trips on these routes." }, { "role": "assistant", "content": "SELECT r.route_id, lo.city AS origin_city, ld.city AS destination_city, AVG(t.pa...
You are an SQL statement expert. Given the table 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": "List all metadata keys and their corresponding values for the asset with symbol 'BTC'." }, { "role": "assistant", "content": "SELECT m.key, m.value\nFROM trading_platform.metadata m\nJOIN trading_platform.assets a ON m.asset_id = a.asset_id\nWHERE a.symbol = 'BTC';"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "For each trip, show the trip ID, vehicle ID, driver ID, and both the actual starting and ending location IDs." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id, origin_location_id, destination_location_id FROM transportation.trips;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance ...
[ { "role": "user", "content": "Show me a list of all appointments with the subject and full name of the assigned lawyer." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.subject, l.first_name || ' ' || l.last_name AS lawyer_full_name\nFROM legal_services.appointments a\nJOIN lega...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "For each contract, can you list the token symbols and total supply of all tokens created by that contract, along with the contract's current status?" }, { "role": "assistant", "content": "SELECT c.contract_id, c.address AS contract_address, c.status, t.token_symbol,...
You are an SQL statement expert. Given the table 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": "Which projects raised funds in January 2022?" }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, investment_date FROM project_fundraising_record WHERE investment_date >= '2022-01-01' AND investment_date < '2022-02-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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "Show the distribution of total supply for tokens, grouped into ranges like < 1 million, 1 million to 1 billion, and > 1 billion. Count how many tokens fall into each range." }, { "role": "assistant", "content": "SELECT CASE WHEN total_supply < 1000000 THEN '< 1 mill...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address cha...
[ { "role": "user", "content": "List all patients who have been prescribed medications with dosage greater than 50mg, along with their medication details and prescribing doctor's name." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, pr.dosage, pr.medication_id, pr.frequenc...
You are an SQL statement expert. Given the table 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 games that have servers deployed in more than one geographical region. Show the game title and the count of regions." }, { "role": "assistant", "content": "SELECT g.title, count(DISTINCT s.region) AS region_count FROM games AS g JOIN servers AS s ON g.game_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.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "Show me the top 5 users who have been involved in trades as both buyers and sellers, along with their email addresses and the count of trades they participated in each role." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, \n COUNT(DISTINCT 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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "For each achievement, can you list its name, the corresponding game's title, and the total number of players who have unlocked it?" }, { "role": "assistant", "content": "SELECT a.name AS achievement_name, g.title AS game_title, COUNT(pa.player_id) AS unlock_count\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 gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date...
[ { "role": "user", "content": "Which service locations do not have a contact phone specified? Show the location_id and location_name." }, { "role": "assistant", "content": "SELECT location_id, location_name\nFROM government_services.service_locations\nWHERE contact_phone IS NULL OR contact_phone ...
You are an SQL statement expert. Given the table 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": "Show me all pairs of servers that are located in the same region, listing both server names and their region." }, { "role": "assistant", "content": "SELECT s1.server_name AS server1_name, s2.server_name AS server2_name, s1.region FROM gaming_technology.servers s1 JO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region text, ip_address text, port integer,...
[ { "role": "user", "content": "Show each user's total count of notifications and, for each, how many of them have been read." }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS total_notifications, COUNT(read_at) AS notifications_read \nFROM trading_platform.notifications \nGROUP 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 trading_platform.trades ( trade_id text, order_id text, buyer_id text, seller_id text, asset_id text, quantity numeric,...
[ { "role": "user", "content": "Get me each user's latest KYC review status along with the number of orders they have placed." }, { "role": "assistant", "content": "WITH latest AS (\n SELECT user_id, status\n FROM trading_platform.kyc_audit\n WHERE (user_id, reviewed_at) IN (\n SELECT user_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "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": "Could you list the trip ID, scheduled and actual arrival times, and the associated vehicle's make and model for all trips where the actual arrival was more than 30 minutes later than scheduled?" }, { "role": "assistant", "content": "SELECT T1.trip_id, T1.scheduled_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 PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "List all users and the total value of all transactions they have initiated. Show user_id, username, and total_transaction_value." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COALESCE(SUM(t.value), 0) AS total_transaction_value\nFROM web3.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 web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the contract address cha...
[ { "role": "user", "content": "Could you list all medications, including their name, manufacturer, and NDC code from the healthcare.medications table?" }, { "role": "assistant", "content": "SELECT medication_name, manufacturer, ndc_code FROM healthcare.medications;" }, { "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 healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd...
[ { "role": "user", "content": "Show me all wallet addresses that belong to user_id 'U12345'." }, { "role": "assistant", "content": "SELECT address_id FROM blockchain.wallets WHERE user_id = 'U12345';" }, { "role": "user", "content": "Now join this with another table to show the privat...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text )
[ { "role": "user", "content": "Show me all users who have commented on posts that are visible as 'unlisted'. I want the usernames and the content of their comments." }, { "role": "assistant", "content": "SELECT u.username, c.content\nFROM social_media.comments c\nJOIN social_media.posts p ON c.po...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "For all claims, show the claim ID, policy ID, incident date, status, and the claim handler ID, only for claims that have both an estimated loss and a settlement amount over 5000." }, { "role": "assistant", "content": "SELECT claim_id, policy_id, incident_date, statu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, -- unique identifier for the claim policy_id charac...
[ { "role": "user", "content": "List all insurance policies along with the product name and product type for each policy." }, { "role": "assistant", "content": "SELECT p.policy_id, p.policy_number, p.start_date, p.end_date, p.premium_amount, ip.product_name, ip.product_type\nFROM insurance.policie...
You are an SQL statement expert. Given the table 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 group conversations that were created after January 1st, 2023, and for each, show the names of hashtags that were created within the same month as the conversation." }, { "role": "assistant", "content": "SELECT c.conversation_id, c.group_name, c.created_at ...
You are an SQL statement expert. Given the table 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.conversations ...
[ { "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": "Find pairs of servers in the same region where one server's last heartbeat was recorded within the last hour, and the other server's last heartbeat was recorded between 1 and 2 hours ago. Show the server names, regions, and last heartbeat timestamps for both servers in each pai...
You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara...
[ { "role": "user", "content": "List all smart money token inflows, showing the token symbol, chain, and USD value." }, { "role": "assistant", "content": "SELECT token_symbol, chain, usd_value FROM smart_money_token_inflow;" }, { "role": "user", "content": "Filter that list to only sho...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.t...
[ { "role": "user", "content": "Show me the earliest created smart contract for each creator address." }, { "role": "assistant", "content": "SELECT sc1.contract_id, sc1.creator_address, sc1.timestamp\nFROM blockchain.smart_contracts sc1\nWHERE sc1.timestamp = (\n SELECT MIN(sc2.timestamp)\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 blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
[ { "role": "user", "content": "I need a report showing, for each server region, how many distinct achievements exist for any game hosted in that region." }, { "role": "assistant", "content": "SELECT s.region,\n COUNT(DISTINCT a.achievement_id) AS achievement_count\nFROM gaming_technology.se...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "List all customers who share an address with another customer. Show both customer IDs, their full names, and the shared address." }, { "role": "assistant", "content": "SELECT a.customer_id AS customer_id_a, a.first_name AS first_name_a, a.last_name AS last_name_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.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "What is the overall average ROI and average PNL for all smart money token performance records?" }, { "role": "assistant", "content": "SELECT AVG(roi) AS overall_average_roi, AVG(pnl) AS overall_average_pnl FROM smart_money_token_performance;" } ]
You are an SQL statement expert. Given the table 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": "Show me the top 5 NFT collections on Ethereum with the highest number of unique owners, along with their names and floor prices." }, { "role": "assistant", "content": "SELECT nc.name, nc.floor_price, COUNT(DISTINCT nh.wallet_address) AS unique_owners FROM nft_collec...
You are an SQL statement expert. Given the table 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 each verified user's username and their total number of public posts." }, { "role": "assistant", "content": "SELECT u.username, COUNT(p.post_id) AS post_count\nFROM social_media.users u\nLEFT JOIN social_media.posts p ON u.user_id = p.user_id AND p.visibility =...
You are an SQL statement expert. Given the table 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": "For each doctor, calculate the total duration of all their appointments. Show doctor_id and the sum of duration_minutes." }, { "role": "assistant", "content": "SELECT doctor_id, SUM(duration_minutes) AS total_duration FROM healthcare.appointments GROUP BY 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.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi...
[ { "role": "user", "content": "Show me the total unbilled billable hours per lawyer." }, { "role": "assistant", "content": "SELECT lawyer_id, SUM(hours_spent) AS total_unbilled_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\n AND is_billed = FALSE\nGROUP BY lawyer_id;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "Show me all transactions (transaction_id, amount, transaction_type) for checking accounts that were opened in the last year, along with the customer_id and account_number." }, { "role": "assistant", "content": "SELECT t.transaction_id, t.amount, t.transaction_type, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac...
[ { "role": "user", "content": "List the first and last names of employees and the full name of the citizens for whom they have scheduled appointments." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , T3.first_name , T3.last_name FROM government_services.employees AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Show the usernames of users who have used any hashtag in their posts, along with the tag name." }, { "role": "assistant", "content": "SELECT DISTINCT T1.username, T4.tag_name FROM social_media.users AS T1 JOIN posts AS T2 ON T1.user_id = T2.user_id JOIN post_hashtag...
You are an SQL statement expert. Given the table 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": "List all fuel logs for vehicle 'VHCL123', showing the fuel type, quantity, and log timestamp." }, { "role": "assistant", "content": "SELECT fuel_type, quantity, log_timestamp FROM transportation.fuel_logs WHERE vehicle_id = 'VHCL123';" }, { "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.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu...
[ { "role": "user", "content": "List all doctors who were created in the last 6 months and have both an email address and phone number listed." }, { "role": "assistant", "content": "SELECT doctor_id, first_name, last_name, created_at FROM healthcare.doctors WHERE created_at >= NOW() - INTERVAL '6 ...
You are an SQL statement expert. Given the table 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": "Find staff who both started and left their position in the same calendar year. Show their staff_id, full name, hire date, and termination date." }, { "role": "assistant", "content": "SELECT staff_id, CONCAT(first_name, ' ', last_name) AS full_name, hire_date, termin...
You are an SQL statement expert. Given the table 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": "Show me all pairs of medications that share the same manufacturer. Include each medication's medication_id, medication_name, and the manufacturer." }, { "role": "assistant", "content": "SELECT m1.medication_id AS med1_id, m1.medication_name AS med1_name, m2.medicati...
You are an SQL statement expert. Given the table 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 the top 3 addresses with the highest profit on the Arbitrum chain, including roi and most_profit_token." }, { "role": "assistant", "content": "SELECT address, profit, roi, most_profit_token FROM smart_money_profit WHERE chain = 'Arbitrum' ORDER BY profit DESC L...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_profit ( address.text, rank.numeric, profit.numeric, roi.numeric, realized_ratio.numeric, most_profit_token...
[ { "role": "user", "content": "List each payment's currency_code, total amount paid, and the number of service orders placed by the same guest for the same reservation." }, { "role": "assistant", "content": "SELECT p.payment_id,\n p.currency_code,\n p.amount AS payment_amount,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu...
[ { "role": "user", "content": "Calculate the average quantity for orders based on their status." }, { "role": "assistant", "content": "SELECT status, AVG(quantity) FROM trading_platform.orders GROUP BY status;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Show me projects that raised funds in 2022 and have a corresponding token held by CEXes on the 'Ethereum' chain. Display the project name, fundraising round name, investment value, the associated token symbol, and the total USD value of that token held by CEXes on Ethereum." ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Retrieve all pairs of nodes where one node was last seen before '2023-06-01' and the other after '2023-06-01', and they share the same IP address." }, { "role": "assistant", "content": "SELECT a.node_id AS node_before,\n b.node_id AS node_after,\n a.ip_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 blockchain.nodes ( node_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port integer NOT ...
[ { "role": "user", "content": "List the top 5 tokens by price_change_percentage_7d, showing token_symbol, narrative, and price_change_percentage_7d." }, { "role": "assistant", "content": "SELECT token_symbol, narrative, price_change_percentage_7d\nFROM token_basic_info\nORDER BY price_change_perc...
You are an SQL statement expert. Given the table 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": "List all maintenance logs for vehicles that had 'Oil Change' service in the last 3 months, showing vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_typ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var...
[ { "role": "user", "content": "Show me all active drivers along with their license expiry dates and the number of trips they've completed in the last month." }, { "role": "assistant", "content": "SELECT d.driver_id, d.first_name, d.last_name, d.license_expiry_date, COUNT(t.trip_id) AS trips_compl...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens...
[ { "role": "user", "content": "Show me the top 5 users who have interacted with the most DApps, along with the count of DApps they interacted with." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(DISTINCT d.dapp_id) AS dapp_count FROM trading_platform.users u JOIN tradi...
You are an SQL statement expert. Given the table 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 service name and online application URL for all inactive services that have an online application URL specified." }, { "role": "assistant", "content": "SELECT service_name, online_application_url FROM government_services.services WHERE is_active = FALSE 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 government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "Count the number of servers for each possible status recorded in the servers table." }, { "role": "assistant", "content": "SELECT status, COUNT(server_id) AS server_count FROM gaming_technology.servers GROUP BY status;" }, { "role": "user", "content": "O...
You are an SQL statement expert. Given the table 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 achievements with more than 100 points." }, { "role": "assistant", "content": "SELECT *\nFROM gaming_technology.achievements\nWHERE points > 100;" }, { "role": "user", "content": "Now exclude any hidden achievements." }, { "role": "assis...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id uuid, game_id uuid, name text, description text, icon_url text, points ...
[ { "role": "user", "content": "For each agency, list the agency name and the count of distinct service categories they offer." }, { "role": "assistant", "content": "SELECT ag.agency_name, COUNT(DISTINCT s.category) AS category_count\nFROM government_services.agencies ag\nJOIN government_services....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "role": "user", "content": "List the booking ID, the first name, and the last name of the passenger for all bookings." }, { "role": "assistant", "content": "SELECT T1.booking_id , T2.first_name , T2.last_name FROM transportation.bookings AS T1 JOIN transportation.passengers AS T2 ON T1.passeng...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "List all 'Epic' rarity in-game items, showing their item_name, item_type, and cost_amount." }, { "role": "assistant", "content": "SELECT item_name, item_type, cost_amount\nFROM gaming_technology.in_game_items\nWHERE rarity = 'Epic';" }, { "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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "Show me all service orders for spa services in the last month, including the guest ID and total price." }, { "role": "assistant", "content": "SELECT so.order_id, so.guest_id, so.total_price FROM hospitality_technology.service_orders so JOIN hospitality_technology.se...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city....
[ { "role": "user", "content": "Which vehicles are assigned to each depot? Display the depot ID, vehicle's license_plate, make, and model." }, { "role": "assistant", "content": "SELECT depot_id, license_plate, make, model\nFROM transportation.vehicles\nWHERE depot_id IS NOT NULL;" }, { "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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "List the plan ID, name, provider, and contact phone for all insurance plans that share the same contact phone as another plan in the system." }, { "role": "assistant", "content": "SELECT t1.plan_id, t1.plan_name, t1.insurance_provider, t1.contact_phone FROM 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.insurance_plans ( plan_id.text, plan_name.text, insurance_provider.text, plan_type.text, contact_phone.text,...
[ { "role": "user", "content": "List the case number and name for all cases that do not have any linked invoices." }, { "role": "assistant", "content": "SELECT T1.case_number, T1.case_name FROM cases AS T1 LEFT JOIN invoices AS T2 ON T1.case_id = T2.case_id WHERE T2.invoice_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 legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man...
[ { "role": "user", "content": "Show me the top 5 projects by valuation that have completed fundraising rounds in the last 12 months, along with their token symbol and price from the token_basic_info table." }, { "role": "assistant", "content": "SELECT pfr.project_name, pfr.valuation, tbi.token_sy...
You are an SQL statement expert. Given the table 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": "Which narratives have both a positive 1-hour and 24-hour price change percentage? Show the narrative name, the 1h change, and the 24h change." }, { "role": "assistant", "content": "SELECT narrative, price_change_percentage_1h, price_change_percentage_24h FROM narrat...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume...
[ { "role": "user", "content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address." }, { "role": "assistant", "content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders nh WHERE nh.contract_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "What is the average ROI for smart money addresses on the Ethereum chain with a realized profit ratio above 50%?" }, { "role": "assistant", "content": "SELECT AVG(roi) as average_roi\nFROM smart_money_token_performance\nWHERE chain = 'Ethereum'\nAND realized_ratio > ...
You are an SQL statement expert. Given the table 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": "Which five customers have the highest cumulative estimated_loss from approved or settled claims? Provide customer_id and total_estimated_loss." }, { "role": "assistant", "content": "SELECT customer_id,\n SUM(estimated_loss) AS total_estimated_loss\nFROM insura...
You are an SQL statement expert. Given the table 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 pairs of invoice numbers for the same case." }, { "role": "assistant", "content": "SELECT T1.invoice_number, T2.invoice_number, T1.case_id FROM legal_services.invoices AS T1 JOIN legal_services.invoices AS T2 ON T1.case_id = T2.case_id AND T1.invoice_id <> 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.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_...
[ { "role": "user", "content": "List all medical report documents with descriptions containing 'x-ray', showing their claim IDs and upload dates." }, { "role": "assistant", "content": "SELECT claim_id, document_id, uploaded_at FROM insurance.claim_documents WHERE document_type = 'medical_report' A...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text, claim_id text, document_type text, file_name text, file_path text, file_s...
[ { "role": "user", "content": "Find all room types that have 'sofa' mentioned in their amenities." }, { "role": "assistant", "content": "SELECT * FROM hospitality_technology.room_types WHERE amenities LIKE '%sofa%'" }, { "role": "user", "content": "Also include the max_occupancy and f...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, -- unique identifier for the room ...
[ { "role": "user", "content": "Count the number of posts that have a media URL but no textual content." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.posts AS T1 WHERE T1.media_url IS NOT NULL AND (T1.content IS NULL OR T1.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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "How many users registered on each date?" }, { "role": "assistant", "content": "SELECT DATE(created_at) AS registration_date, COUNT(*) AS user_count FROM web3.users GROUP BY DATE(created_at) ORDER BY registration_date;" }, { "role": "user", "content": "Ac...
You are an SQL statement expert. Given the table 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.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
[ { "role": "user", "content": "Show me the total transaction amount and count for each account type. Please include the account type and the total amount and count from the transactions table." }, { "role": "assistant", "content": "SELECT\n a.account_type,\n SUM(t.amount) AS total_transaction_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.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "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": "Show all payments made for reservations that had more than 2 adults. Include the payment ID, amount, currency, reservation ID, guest full name, and the number of adults in the reservation." }, { "role": "assistant", "content": "SELECT T1.payment_id, T1.amount, T1.cu...
You are an SQL statement expert. Given the table 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 the total number of chronic diagnoses for each code_type." }, { "role": "assistant", "content": "SELECT\n code_type,\n COUNT(*) AS chronic_diagnosis_count\nFROM healthcare.diagnoses\nWHERE is_chronic = TRUE\nGROUP BY code_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 healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty...
[ { "role": "user", "content": "Show me all users who have unread notifications sent more than 3 days ago, along with the notification message and when it was sent." }, { "role": "assistant", "content": "SELECT user_id, message, sent_at FROM trading_platform.notifications WHERE read_at IS NULL 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 trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp...
[ { "role": "user", "content": "Show me the top 3 countries by total number of registered guests. Include country_code and guest_count." }, { "role": "assistant", "content": "SELECT g.country_code, COUNT(*) AS guest_count\nFROM hospitality_technology.guests g\nGROUP BY g.country_code\nORDER BY gue...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 6 months, along with their latest round name and investment value." }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, valuation FROM project...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE project_fundraising_record (", "id character varying(32) NOT NULL, -- fundraising record id", "project_id ch...
[ { "role": "user", "content": "List customers who have both a canceled policy and an active policy. Show customer_id, canceled_policy_id, and active_policy_id." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.policy_id AS canceled_policy_id,\n p2.policy_id AS active_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "List all routes where the origin and destination are in the same state, showing the route_number, state, origin city, destination city, distance_km, and type." }, { "role": "assistant", "content": "SELECT r.route_number, o.state_province AS state, o.city AS origin_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 transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "Can you list each user's theme setting along with the number of likes they have given to posts?" }, { "role": "assistant", "content": "SELECT us.user_id, us.theme, COUNT(l.like_id) AS like_count FROM social_media.user_settings us LEFT JOIN social_media.likes l ON 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 social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp ) CREATE TABLE soc...
[ { "role": "user", "content": "Show me all trades (trade_id, security_id, total_amount) executed by employees in the 'Investment' department, along with their employee_id and first_name." }, { "role": "assistant", "content": "SELECT t.trade_id, t.security_id, t.total_amount, e.employee_id, e.firs...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity....
[ { "role": "user", "content": "For each guest, show their full name and the total quantity of services they have ordered in the last 30 days." }, { "role": "assistant", "content": "SELECT g.guest_id,\n g.first_name || ' ' || g.last_name AS full_name,\n SUM(so.quantity) AS total_quanti...
You are an SQL statement expert. Given the table 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 Sui NFT collections where the owner is not null, including their name and collection_type." }, { "role": "assistant", "content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL;" }, { "role": "user", "content": "Can you filte...
You are an SQL statement expert. Given the table 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": "How many available services are there per department for each property? Include property_id, department, and the service count." }, { "role": "assistant", "content": "SELECT\n property_id,\n department,\n COUNT(*) AS available_services_count\nFROM hospitality_tec...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "List all patients who have both a primary insurance plan and at least one completed appointment, including their insurance provider names." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, i.insurance_provider FROM healthcare.patients p JOIN h...
You are an SQL statement expert. Given the table 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 smart contracts where the code length is greater than 1000 characters." }, { "role": "assistant", "content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE LENGTH(code) > 1000;" }, { "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 blockchain.smart_contracts ( contract_id text PRIMARY KEY, creator_address text, code text, timestamp timestamp )
[ { "role": "user", "content": "List the item_id, item_name, cost_amount, game title, and developer name for all items with rarity = 'Rare'." }, { "role": "assistant", "content": "SELECT i.item_id,\n i.item_name,\n i.cost_amount,\n g.title,\n d.name\nFROM gaming_technology....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "Show for every asset the usernames of users who have both bought and sold that asset, along with the asset name." }, { "role": "assistant", "content": "SELECT DISTINCT a.asset_id, a.name AS asset_name, u.username\nFROM trading_platform.assets a\nJOIN trading_platfor...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "For each customer, show their full name, email, and the total trade amount they have made, joining customers to trades via account_id." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name, c.email, SUM(t.total_amount) AS total_trade...
You are an SQL statement expert. Given the table 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...