conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "How many applications are currently in 'Processing' status? Return the total count." }, { "role": "assistant", "content": "SELECT COUNT(*) AS processing_applications_count\nFROM government_services.applications\nWHERE status = 'Processing';" } ]
You are an SQL statement expert. Given the table 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": "List all pairs of contracts deployed on the same day by the same deployer. Show deployer_address, deployment date, and both contract IDs." }, { "role": "assistant", "content": "SELECT\n c1.deployer_address,\n DATE(c1.deployed_at) AS deployment_date,\n c1.contract...
You are an SQL statement expert. Given the table 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": "List all comments made on public posts that have a location specified, including comment_id, post_id, comment content, and the comment's created_at timestamp." }, { "role": "assistant", "content": "SELECT c.comment_id,\n c.post_id,\n c.content,\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.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u...
[ { "role": "user", "content": "Find the user ID with the most wallets and list their user ID and the total number of wallets they have." }, { "role": "assistant", "content": "SELECT user_id, COUNT(wallet_id) AS wallet_count FROM web3.wallets GROUP BY user_id ORDER BY wallet_count DESC LIMIT 1;" ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(6...
[ { "role": "user", "content": "Show me all cryptocurrency assets that have metadata entries for both 'category' and 'blockchain_network', along with their corresponding values." }, { "role": "assistant", "content": "SELECT m1.asset_id, m1.value AS category, m2.value AS blockchain_network FROM tra...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "List all patients who have received a prescription with the route 'Topical', showing their ID, first name, and last name." }, { "role": "assistant", "content": "SELECT DISTINCT\n p.patient_id,\n p.first_name,\n p.last_name\nFROM\n healthcare.patients p\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Find all pairs of distinct appointments for the same case that overlap in time. Show both appointment IDs, the case_id, and the start_time and end_time of each appointment." }, { "role": "assistant", "content": "SELECT a1.appointment_id AS appointment_id_1,\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 legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "For each room, list the room number, property name, and the type name of the room." }, { "role": "assistant", "content": "SELECT r.room_number, p.property_name, rt.type_name\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.properties p ON r.property...
You are an SQL statement expert. Given the table 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": "Provide a summary for each user, showing their associated KYC status and the total number of UTXOs connected to them." }, { "role": "assistant", "content": "SELECT kyc.user_id, kyc.status, COUNT(u.utxo_id) AS utxo_count FROM trading_platform.kyc_audit kyc 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.utxos ( utxo_id.text, transaction_id.text, output_index.integer, address.text, amount.numeric, spent.b...
[ { "role": "user", "content": "For each recipient address, count how many token transfers they have received." }, { "role": "assistant", "content": "SELECT to_address, COUNT(*) AS received_transfer_count FROM web3.token_transfers GROUP BY to_address;" }, { "role": "user", "content": "...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ...
[ { "role": "user", "content": "Generate a report that lists each manager’s full name and the count of direct reports they have." }, { "role": "assistant", "content": "SELECT m.employee_id,\n m.first_name || ' ' || m.last_name AS manager_name,\n COUNT(e.employee_id) AS direct_repo...
You are an SQL statement expert. Given the table 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, -- unique identifier for the trans...
[ { "role": "user", "content": "Can you list each citizen's first and last name, contact email, and the total amount they have paid for succeeded payments?" }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, c.contact_email, SUM(p.amount) AS total_paid FROM 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.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "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.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "For each doctor, count how many medical record entries they have created and show the doctor_id alongside the record count." }, { "role": "assistant", "content": "SELECT doctor_id, COUNT(*) AS record_count\nFROM healthcare.medical_records\nGROUP 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.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "Find all pairs of transactions that occurred in the same block and were sent to the same address. Show both transaction IDs, the shared recipient address, and the block number." }, { "role": "assistant", "content": "SELECT t1.transaction_id AS tx1,\n t2.transa...
You are an SQL statement expert. Given the table 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": "Show me the top 5 NFT collections with the highest average rarity score, along with their contract addresses and names." }, { "role": "assistant", "content": "SELECT contract_address, name, AVG(rarity_score) as avg_rarity_score FROM nft_metadata GROUP BY contract_ad...
You are an SQL statement expert. Given the table 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": "List pairs of documents uploaded by the same lawyer, showing uploader ID and both document names." }, { "role": "assistant", "content": "SELECT d1.uploaded_by_lawyer_id, d1.document_name AS doc1, d2.document_name AS doc2 FROM legal_services.documents d1 JOIN legal_s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "How many unique tokens are recorded for each chain in the latest snapshot in cex_token_balance?" }, { "role": "assistant", "content": "WITH latest_snapshot AS (\n SELECT MAX(snapshot_time) AS max_time FROM cex_token_balance\n)\nSELECT \n chain, \n COUNT(DISTINCT ...
You are an SQL statement expert. Given the table 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.text, chain.text, address.text, exchange.text, token_address.text, token_symbol.text,...
[ { "role": "user", "content": "List the usernames of users who have commented on posts that are not replies to other comments." }, { "role": "assistant", "content": "SELECT DISTINCT T2.username FROM social_media.comments AS T1 JOIN social_media.users AS T2 ON T1.user_id = T2.user_id WHERE T1.pare...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "List all active staff members who are managers, along with their hire dates and email addresses." }, { "role": "assistant", "content": "SELECT staff_id, first_name, last_name, position, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true 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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Please show me the first name, last name, and date of birth for all passengers born between 1990 and 1999, inclusive." }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth FROM transportation.passengers WHERE date_of_birth BETWEEN '1990-...
You are an SQL statement expert. Given the table 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 each user's username and the total number of trades they've participated in as buyers, including users who have not made any trades, sorted by the trade count descending." }, { "role": "assistant", "content": "SELECT u.username, COUNT(t.trade_id) AS buy_trade_c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Find all pairs of overlapping payment periods for the same customer. Return customer_id, first payment_id as payment1_id, second payment_id as payment2_id, and both periods' start and end dates." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment po...
[ { "role": "user", "content": "List the top 5 most used services across all properties. Show service_name and total quantity ordered, ordered by quantity descending." }, { "role": "assistant", "content": "SELECT s.service_name,\n SUM(o.quantity) AS total_quantity\nFROM 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.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me the count of approval-for-all events for each ERC1155 contract." }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_address;" }, { "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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "Show a list of diagnoses along with the chief complaint noted in the corresponding medical record. Display diagnosis description, diagnosis date, and the chief complaint." }, { "role": "assistant", "content": "SELECT T1.description, T1.diagnosis_date, T2.chief_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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch...
[ { "role": "user", "content": "List the names and prices of all services available in the 'Food & Beverage' department." }, { "role": "assistant", "content": "SELECT service_name, price\nFROM hospitality_technology.services\nWHERE department = 'Food & Beverage' AND is_available = TRUE;" }, { ...
You are an SQL statement expert. Given the table 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": "Find all pairs of users where the registration times are within 30 minutes of each other, and show both user IDs, usernames, and the time difference in minutes." }, { "role": "assistant", "content": "SELECT u1.user_id AS user1_id, u1.username AS user1_name, u2.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.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
[ { "role": "user", "content": "Show me all drivers and the vehicles they are assigned for trips that have status 'Delayed'. Include driver first_name, driver last_name, vehicle license_plate, trip_id, and actual_departure." }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, v...
You are an SQL statement expert. Given the table 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 me each staff member by response_staff_id and the number of unique guests whose reviews they have responded to." }, { "role": "assistant", "content": "SELECT response_staff_id, COUNT(DISTINCT guest_id) AS unique_guest_count\nFROM hospitality_technology.reviews\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reviews ( review_id text, property_id text, reservation_id text, guest_id text, rating_overall i...
[ { "role": "user", "content": "Find policy numbers that are associated with more than one distinct patient, and list the policy number along with the count of distinct patients using it." }, { "role": "assistant", "content": "SELECT policy_number, COUNT(DISTINCT patient_id) AS distinct_patient_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 healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p...
[ { "role": "user", "content": "List all users who have deployed contracts, along with their email addresses and the total value of token transfers associated with those contracts." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, SUM(tt.value) AS total_transfer_value FROM web3.use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Get the total number of guests for each country_code." }, { "role": "assistant", "content": "SELECT country_code, COUNT(*) AS guest_count\nFROM hospitality_technology.guests\nGROUP BY country_code;" }, { "role": "user", "content": "Actually, only include...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "Show me each guest's total payment amount and total number of reservations, including their guest_id. Only include guests who have at least two reservations." }, { "role": "assistant", "content": "SELECT r.guest_id, SUM(p.amount) AS total_payment_amount, COUNT(DISTI...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, property_id text, guest_id text, room_id text, r...
[ { "role": "user", "content": "Show me the number of players who registered each year. List the registration year and the count." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM registration_date) AS registration_year, COUNT(*) AS player_count FROM gaming_technology.players GROUP 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "Can you list all pairs of doctors where one mentors another (meaning they share the same specialty and the mentor was created in the system before the mentee)? Include the full names of both the mentor and the mentee, as well as their shared specialty." }, { "role": "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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "List each policy ID and its customer ID for which there are both premium payments recorded and beneficiaries listed. Include the total amount paid for that policy by that customer and the count of beneficiaries listed for that policy by that customer." }, { "role": "ass...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "List all doctors who don't have a hospital affiliation, including their full names and specialties." }, { "role": "assistant", "content": "SELECT first_name, last_name, specialty FROM healthcare.doctors WHERE hospital_affiliation_id IS NULL;" }, { "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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor first_name ...
[ { "role": "user", "content": "Show me each developer's name and the number of different games they have published on each platform." }, { "role": "assistant", "content": "SELECT d.name AS developer_name, g.platform, COUNT(DISTINCT g.game_id) AS game_count\nFROM gaming_technology.developers d\nJO...
You are an SQL statement expert. Given the table 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": "I need a count of games per platform and the earliest release date on each platform." }, { "role": "assistant", "content": "SELECT platform, COUNT(*) AS game_count, MIN(release_date) AS first_release\nFROM gaming_technology.games\nGROUP BY platform;" }, { "r...
You are an SQL statement expert. Given the table 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": "Show me the names and manufacturers of all medications that have a description provided." }, { "role": "assistant", "content": "SELECT medication_name, manufacturer FROM healthcare.medications WHERE description IS NOT NULL;" }, { "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 healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,...
[ { "role": "user", "content": "Show me all active policies with coverage limits above $1,000,000, along with the customer names and agent names, sorted by coverage limit in descending order." }, { "role": "assistant", "content": "SELECT p.policy_id, p.customer_id, p.agent_id, p.coverage_limit, p....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "Show me all medical records where the chief complaint contains 'fever' and include the patient_id, record_date, and assessment details." }, { "role": "assistant", "content": "SELECT patient_id, record_date, assessment FROM healthcare.medical_records WHERE chief_comp...
You are an SQL statement expert. Given the table 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.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam...
[ { "role": "user", "content": "Show me all agents and their managers' full names. For each agent, include agent_id, agent's first and last name, and their manager's first and last name." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name AS agent_first_name, a.last_name AS agen...
You are an SQL statement expert. Given the table 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": "Which users have registered but never created a wallet? Show their user_id, username, and email." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, u.email\nFROM trading_platform.users u\nLEFT JOIN trading_platform.wallets w ON u.user_id = w.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.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Find all distinct pairs of customers having the same first_name but living in different cities. Display a.customer_id, a.first_name, a.city AS city_a, b.customer_id, b.city AS city_b." }, { "role": "assistant", "content": "SELECT a.customer_id AS customer_id_a,\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 financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Show me the top 5 users with the most wallets, along with their email domains." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, SUBSTRING(u.email FROM '@(.+)$') AS email_domain, COUNT(w.wallet_id) AS wallet_count FROM blockchain.users u JOIN bloc...
You are an SQL statement expert. Given the table 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": "Get the total ERC20 balance per contract_address across all wallets from erc20_balances." }, { "role": "assistant", "content": "SELECT contract_address,\n SUM(CAST(amount AS NUMERIC)) AS total_balance\nFROM erc20_balances\nGROUP BY contract_address\nORDER BY 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 erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar ) CR...
[ { "role": "user", "content": "Show the full name of each manager and the average commission rate of the agents who report directly to them. Only include managers who have at least one reporting agent." }, { "role": "assistant", "content": "SELECT T2.first_name AS manager_first_name, T2.last_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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "Find all doctors created in the last 6 months who have both a phone number and email listed, showing their full name, specialty, and contact details." }, { "role": "assistant", "content": "SELECT first_name, last_name, specialty, phone_number, email FROM healthcare....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number...
[ { "role": "user", "content": "For each token, show its token_id, decimals, and the average total_supply of all tokens with the same decimals." }, { "role": "assistant", "content": "SELECT t.token_id,\n t.decimals,\n avg_data.avg_total_supply\nFROM web3.tokens t\nJOIN (\n SELECT deci...
You are an SQL statement expert. Given the table 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 each post_id, user_id, and the number of hashtags associated with that post for posts with visibility = 'public'." }, { "role": "assistant", "content": "SELECT p.post_id, p.user_id, COUNT(ph.hashtag_id) AS hashtag_count\nFROM social_media.posts p\nLEFT JOIN soc...
You are an SQL statement expert. Given the table 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": "For each patient, calculate the total duration of all their completed appointments. Show the patient ID and the total duration in minutes, sorted by total duration descending." }, { "role": "assistant", "content": "SELECT patient_id, SUM(duration_minutes) AS total_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 healthcare.appointments ( appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment ...
[ { "role": "user", "content": "Count the number of documents submitted for each service. Show the service_name and the document_count." }, { "role": "assistant", "content": "SELECT s.service_name, COUNT(d.document_id) AS document_count\nFROM government_services.services s\nJOIN government_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 government_services.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eli...
[ { "role": "user", "content": "List all patients who have a current prescription that was prescribed by a doctor with a specialty of 'Endocrinology'. Show patient full name, prescription ID, medication name, and prescription date." }, { "role": "assistant", "content": "SELECT p.patient_id, p.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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "List all rooms on the 5th floor for every property, showing room number and property name." }, { "role": "assistant", "content": "SELECT r.room_number, p.property_name\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.properties p ON r.property_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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Could you list all pairs of developers in the same country but different companies? Return developer1, developer2, and country." }, { "role": "assistant", "content": "SELECT d1.name AS developer1,\n d2.name AS developer2,\n d1.country\nFROM gaming_techno...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_...
[ { "role": "user", "content": "Show the first name and last name of customers along with the payment method for all their premium payments." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.payment_method FROM insurance.customers AS T1 JOIN insurance.premium_payments 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.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Show me all reviews with ratings of 5 stars, including the property name and review date." }, { "role": "assistant", "content": "SELECT r.review_id, p.property_name, r.review_date FROM hospitality_technology.reviews r JOIN hospitality_technology.properties p ON r.pr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Show me all patients who have scheduled appointments with doctors specializing in Cardiology, along with their appointment times and reasons." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, a.reason FROM hea...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List each user_id and the date of their latest log." }, { "role": "assistant", "content": "SELECT user_id, MAX(logged_at) AS latest_log\nFROM trading_platform.logs\nGROUP BY user_id;" }, { "role": "user", "content": "Please also show the total number of ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.utxos ( utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO transaction...
[ { "role": "user", "content": "For each claim, retrieve the document_id, file_name, and uploaded_at of the earliest and the latest uploaded document." }, { "role": "assistant", "content": "SELECT\n c1.claim_id,\n c1.document_id AS earliest_document_id,\n c1.file_name AS earliest_file_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 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 unique diagnosis codes that are associated with more than one doctor, and show how many doctors are linked to each code." }, { "role": "assistant", "content": "SELECT diagnosis_code, COUNT(DISTINCT doctor_id) AS doctor_count FROM healthcare.diagnoses GROUP ...
You are an SQL statement expert. Given the table 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 the top 5 transactions with the highest number of token transfers, along with their Ethereum value. Include transaction_id, token_transfer_count, and ether_value." }, { "role": "assistant", "content": "SELECT\n tt.transaction_id,\n COUNT(tt.transfer_id) AS to...
You are an SQL statement expert. Given the table 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, from_address character varying(128) NOT NULL, to_add...
[ { "role": "user", "content": "What's the average session duration and average score per game genre?" }, { "role": "assistant", "content": "SELECT g.genre,\n AVG(gs.duration_seconds) AS avg_duration,\n AVG(gs.score) AS avg_score\nFROM gaming_technology.game_sessions gs\nJOIN gaming_te...
You are an SQL statement expert. Given the table 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 patients who have both primary and non-primary insurance plans, along with their policy numbers and expiration dates." }, { "role": "assistant", "content": "SELECT p1.patient_id, p1.policy_number AS primary_policy, p1.expiration_date AS primary_expiry, p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb...
[ { "role": "user", "content": "Show me the username and email of all users who own at least one wallet." }, { "role": "assistant", "content": "SELECT DISTINCT T1.username, T1.email FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text ) CREATE TABLE blockchain.users ( ...
[ { "role": "user", "content": "List all active staff members (is_active = true) along with their position and hire date, ordered by hire date from newest to oldest." }, { "role": "assistant", "content": "SELECT first_name, last_name, position, hire_date FROM hospitality_technology.staff WHERE is_...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i...
[ { "role": "user", "content": "For each branch, show the number of employees and the average tenure in days for those currently active." }, { "role": "assistant", "content": "SELECT branch_id, COUNT(*) AS employee_count, AVG(DATE_PART('day', CURRENT_DATE - hire_date)) AS avg_tenure_days\nFROM fin...
You are an SQL statement expert. Given the table 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": "How many unique email domains are there among all registered users?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT SUBSTRING(email FROM POSITION('@' IN email)+1)) AS unique_domains FROM blockchain.users;" }, { "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 blockchain.users ( user_id text, username text, email text, password_hash text )
[ { "role": "user", "content": "For all chains, which token held by centralized exchanges (CEX) has the highest ROI according to smart money token performance? Show token symbol, chain, exchange, total USD value held on CEX, and the smart money ROI." }, { "role": "assistant", "content": "SELECT 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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "I want to find total PNL and average ROI of smart money token performance for each narrative category. Only include narratives with average ROI greater than 0.5." }, { "role": "assistant", "content": "SELECT bi.narrative,\n SUM(smtp.pnl) AS total_pnl,\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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "How many notifications across the entire system have been read?" }, { "role": "assistant", "content": "SELECT COUNT(*)\nFROM social_media.notifications\nWHERE read_at 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.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t...
[ { "role": "user", "content": "Retrieve all public posts that have geolocation coordinates specified, showing post_id, user_id, location_lat, location_lon, ordered by created_at descending." }, { "role": "assistant", "content": "SELECT post_id, user_id, location_lat, location_lon\nFROM social_med...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "List all insurance plans along with their provider, plan type, and the contact phone number. Also, for each plan, show how many doctors have their hospital affiliation ID matching the plan ID." }, { "role": "assistant", "content": "SELECT ip.plan_id, ip.plan_name, 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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "For each agent, show the total number of policies they have sold and the sum of the premium amounts. Include the agent_id." }, { "role": "assistant", "content": "SELECT agent_id, COUNT(*) AS policy_count, SUM(premium_amount) AS total_premium\nFROM insurance.policies...
You are an SQL statement expert. Given the table 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 the top 3 narratives by 7-day price change percentage from the narrative_info table." }, { "role": "assistant", "content": "SELECT narrative, price_change_percentage_7d\nFROM narrative_info\nORDER BY price_change_percentage_7d DESC\nLIMIT 3;" }, { "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 narrative_info (", "narrative character varying(512) NOT NULL, -- the id of narrative", "top_3_coins text, --...
[ { "role": "user", "content": "Show me the top 5 ERC20 tokens with the highest current price, along with their symbols and contract addresses." }, { "role": "assistant", "content": "SELECT t.symbol, t.address, t.price FROM token_prices_latest t ORDER BY t.price DESC LIMIT 5;" }, { "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_timestamp timestamp(3) NOT NULL, transaction_index integ...
[ { "role": "user", "content": "For each loan, calculate the number of days until maturity. Display loan_id, account_id, maturity_date, and days_to_maturity as the difference between maturity_date and CURRENT_DATE." }, { "role": "assistant", "content": "SELECT loan_id,\n account_id,\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 financial_services.loans ( loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same...
[ { "role": "user", "content": "For each account type, what is the total principal amount outstanding on loans and the average interest rate?" }, { "role": "assistant", "content": "SELECT T2.account_type, SUM(T1.current_principal_balance) AS total_current_loan_principal, AVG(T1.interest_rate) AS 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 text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "Find all contracts deployed by users who have also conducted transactions with a value greater than 1 ETH (where 1 ETH = 1e18 wei)." }, { "role": "assistant", "content": "SELECT DISTINCT c.contract_id, c.address, c.deployer_address FROM web3.contracts c JOIN web3.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.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "How many bookings were made each day in April 2024?" }, { "role": "assistant", "content": "SELECT DATE(booking_time) AS booking_date, COUNT(*) AS booking_count FROM transportation.bookings WHERE EXTRACT(YEAR FROM booking_time) = 2024 AND EXTRACT(MONTH FROM booking_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 transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ...
[ { "role": "user", "content": "Show policy numbers, start dates, and the type of the insurance product for policies with a deductible greater than 500." }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.start_date, T2.product_type FROM insurance.policies AS T1 JOIN insurance.insur...
You are an SQL statement expert. Given the table 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": "Can you show a list of all distinct medication IDs along with the count of prescriptions for each medication, including only medications that have been prescribed more than 50 times? Also, please display the total quantity dispensed for each medication." }, { "role": "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 healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, -- unique identifier for the prescriptio...
[ { "role": "user", "content": "Find tokens with a 24-hour DEX trading volume greater than $500,000. For these tokens, display their symbol, chain, the 24h volume from the DEX pool, and the narrative category they belong to from the smart money inflow data." }, { "role": "assistant", "content": "S...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "Calculate the total points from all achievements unlocked by each player. Show player_id and total points." }, { "role": "assistant", "content": "SELECT pa.player_id, SUM(a.points) AS total_points FROM gaming_technology.player_achievements AS pa JOIN gaming_technolo...
You are an SQL statement expert. Given the table 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 pairs of law firms that are located at the same address. Display the names of both firms and the shared address, ensuring the address is not null." }, { "role": "assistant", "content": "SELECT\n t1.firm_name AS firm1_name,\n t2.firm_name AS firm2_name,\n t1....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t...
[ { "role": "user", "content": "For each doctor, find the longest single appointment duration. Return doctor_id, first_name, last_name, and max_duration." }, { "role": "assistant", "content": "SELECT d.doctor_id,\n d.first_name,\n d.last_name,\n MAX(a.duration_minutes) AS max_dur...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "List all guests from California who are loyalty members and have provided their email addresses, ordered by last name." }, { "role": "assistant", "content": "SELECT guest_id, first_name, last_name, email, phone_number FROM hospitality_technology.guests WHERE state_p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city....
[ { "role": "user", "content": "Find all wallets created by users in the last 7 days along with any tokens that have a total supply greater than 10 million, showing the wallet address and token details." }, { "role": "assistant", "content": "SELECT w.address AS wallet_address, t.token_name, t.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 web3.tokens ( token_id character varying(64) NOT NULL, contract_address character varying(128) NOT NULL, token_name cha...
[ { "role": "user", "content": "For each asset, show its name and the number of metadata entries associated with it, including assets with zero metadata, sorted by asset name ascending." }, { "role": "assistant", "content": "SELECT a.name, COUNT(m.metadata_id) AS metadata_count\nFROM trading_platf...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Show me each achievement name and the number of players who have unlocked it." }, { "role": "assistant", "content": "SELECT a.name,\n COUNT(pa.player_id) AS unlock_count\nFROM gaming_technology.achievements a\nLEFT JOIN gaming_technology.player_achievements 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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "List all patients who have been prescribed medications with dosage greater than 100mg, including their names and the medication details." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, m.medication_name, m.generic_name, pr.dosage FROM health...
You are an SQL statement expert. Given the table 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": "Find beneficiaries with percentage_share above 50% for policies that have any claim with estimated_loss greater than 20000. Show beneficiary_id, first_name, last_name, and policy_id." }, { "role": "assistant", "content": "SELECT pb.beneficiary_id, pb.first_name, pb....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d...
[ { "role": "user", "content": "List all posts where the content mentions 'meeting'." }, { "role": "assistant", "content": "SELECT post_id, user_id, content, created_at FROM social_media.posts WHERE content LIKE '%meeting%'" }, { "role": "user", "content": "Also, only include those pos...
You are an SQL statement expert. Given the table 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": "Show me a list of all patient names along with the full names of their doctors for appointments scheduled in February 2024." }, { "role": "assistant", "content": "SELECT p.first_name AS patient_first_name, p.last_name AS patient_last_name, d.first_name AS doctor_fir...
You are an SQL statement expert. Given the table 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": "I need a list of conversation IDs and participant usernames for conversations that have media messages. Include conversation_id, username, and media_type." }, { "role": "assistant", "content": "SELECT m.conversation_id, u.username, m.media_type\nFROM social_media.me...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "Find tokens on the 'Polygon' chain with a market cap greater than $1,000,000,000 and a positive price change in the last 24 hours. List their symbol, name, market cap, and 24h price change." }, { "role": "assistant", "content": "SELECT token_symbol, token_name, mark...
You are an SQL statement expert. Given the table 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 each chronic active diagnosis along with the prescribed medication details, showing diagnosis_id, diagnosis_code, medication_id, dosage, and diagnosis_date." }, { "role": "assistant", "content": "SELECT d.diagnosis_id, d.diagnosis_code, p.medication_id, p.dosag...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show me the latest token activities on Avalanche, listing the type, amount, and timestamp." }, { "role": "assistant", "content": "SELECT type, amt, block_timestamp FROM token_activities_avalanche ORDER BY block_timestamp DESC LIMIT 100" }, { "role": "user", ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch...