conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "List all token transfers where the value is an even number, showing transfer ID, token ID, value, and transaction ID." }, { "role": "assistant", "content": "SELECT transfer_id, token_id, value, transaction_id\nFROM web3.token_transfers\nWHERE MOD(value, 2) = 0;" }...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id.text, token_id.text, from_address.text, to_address.text, value.numeric, transaction_...
[ { "role": "user", "content": "Which agents, along with their managers' full names, are licensed in 'TX' and are currently active?" }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name AS agent_first_name, a.last_name AS agent_last_name, m.first_name AS manager_first_name, m.last...
You are an SQL statement expert. Given the table 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": "Show me all contracts deployed on the 'ethereum' network along with their deployer usernames and email addresses." }, { "role": "assistant", "content": "SELECT c.contract_id, c.address, u.username, u.email FROM web3.contracts c JOIN web3.users u ON c.deployer_addres...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "Show me all patients who have both an email address and an emergency contact listed, along with their insurance plan details if available." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, p.email, p.emergency_contact_name, p.eme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "For each player, show their player_id and the number of unique games they have played sessions on." }, { "role": "assistant", "content": "SELECT player_id, COUNT(DISTINCT game_id) AS unique_games\nFROM gaming_technology.game_sessions\nGROUP BY player_id;" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "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": "Which users have joined private conversations (not group chats), and what are the conversation IDs and join times?" }, { "role": "assistant", "content": "SELECT u.username, cp.conversation_id, cp.joined_at\nFROM social_media.conversation_participants cp\nJOIN social...
You are an SQL statement expert. Given the table 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 active staff members who are managers, along with their hire dates and email addresses." }, { "role": "assistant", "content": "SELECT staff_id, first_name, last_name, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true AND positio...
You are an SQL statement expert. Given the table 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": "How many distinct relationships are listed for policy beneficiaries?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT relationship) FROM insurance.policy_beneficiaries;" } ]
You are an SQL statement expert. Given the table 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.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, la...
[ { "role": "user", "content": "Show me all customers (customer_id, first_name, last_name) who have both a checking account (account_type = 'Checking') and a savings account (account_type = 'Savings'), along with their total combined balance." }, { "role": "assistant", "content": "SELECT c.custome...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "List all CEX addresses on the BSC chain that hold more than $1 million USD value in total." }, { "role": "assistant", "content": "SELECT address, SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE chain = 'BSC' GROUP BY address HAVING SUM(usd_value) > 10...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE cex_token_balance (", "snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ...
[ { "role": "user", "content": "Show the first name, last name, and email for all guests created in 2023." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM guests WHERE created_at >= '2023-01-01' AND created_at < '2024-01-01';" }, { "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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me all active policies with coverage limits above $1,000,000, along with their customer IDs and agent IDs, sorted by coverage limit in descending order." }, { "role": "assistant", "content": "SELECT p.policy_id, p.customer_id, p.agent_id, p.coverage_limit FROM ...
You are an SQL statement expert. Given the table 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 services whose eligibility criteria mention 'citizen'." }, { "role": "assistant", "content": "SELECT service_id, service_name, eligibility_criteria FROM government_services.services WHERE eligibility_criteria ILIKE '%citizen%';" } ]
You are an SQL statement expert. Given the table 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 PRIMARY KEY, agency_id text, service_name text, description text, catego...
[ { "role": "user", "content": "Get the count of room types and the average area_sqft per property." }, { "role": "assistant", "content": "SELECT property_id,\n COUNT(room_type_id) AS room_type_count,\n AVG(area_sqft) AS avg_area\nFROM hospitality_technology.room_types\nGROUP BY 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 character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List all inactive insurance products along with their creation dates." }, { "role": "assistant", "content": "SELECT product_name, created_at FROM insurance.insurance_products WHERE is_active = false;" }, { "role": "user", "content": "Now order them by th...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "List all staff who have ever managed a property, showing the staff full name and the property name they managed." }, { "role": "assistant", "content": "SELECT s.first_name, s.last_name, p.property_name\nFROM hospitality_technology.staff s\nJOIN 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.text, property_name.text, address_line1.text, address_line2.text, city....
[ { "role": "user", "content": "Show me all PDF documents uploaded by agent 'AG456', along with their claim IDs and file sizes." }, { "role": "assistant", "content": "SELECT claim_id, file_size_bytes FROM insurance.claim_documents WHERE mime_type = 'application/pdf' AND uploaded_by = 'AG456';" }...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "How many users have push notifications disabled?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS user_count\nFROM social_media.user_settings\nWHERE push_notifications_enabled = false;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "Find all wallets created in the last 30 days along with any tokens they might have deployed, showing the wallet address and token names." }, { "role": "assistant", "content": "SELECT w.address, t.token_name FROM web3.wallets w LEFT JOIN web3.contracts c ON w.address...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "Show me the total amount processed by each payment method, grouped by currency code." }, { "role": "assistant", "content": "SELECT payment_method, currency_code, SUM(amount) as total_amount FROM hospitality_technology.payments GROUP BY payment_method, currency_code ...
You are an SQL statement expert. Given the table 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.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu...
[ { "role": "user", "content": "How many comments were made by user 'U999'?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.comments WHERE user_id = 'U999';" } ]
You are an SQL statement expert. Given the table 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": "I would like to see a list of all medical records where the chief complaint contains the word 'cough' along with the doctor's ID and the date of the record." }, { "role": "assistant", "content": "SELECT record_id, doctor_id, record_date, chief_complaint FROM healthc...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "Show all active staff members' full names and their positions." }, { "role": "assistant", "content": "SELECT staff_id, first_name || ' ' || last_name AS staff_full_name, position\nFROM hospitality_technology.staff\nWHERE is_active = true;" }, { "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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Show me all NFT holders who own more than 10 of the same token, including the contract address, token ID, and wallet address." }, { "role": "assistant", "content": "SELECT nh.contract_address, nh.token_id, nh.wallet_address, CAST(nh.amount AS decimal) AS token_count...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.t...
[ { "role": "user", "content": "Can you give me the number of available services and their average price for each department?" }, { "role": "assistant", "content": "SELECT department, COUNT(*) AS available_services_count, AVG(price) AS average_price\nFROM hospitality_technology.services\nWHERE 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.services ( service_id text, property_id text, service_name text, description text, category text...
[ { "role": "user", "content": "List each patient_id along with the policy_number of their primary plan and the policy_number of any secondary (non-primary) plan they hold." }, { "role": "assistant", "content": "SELECT p_primary.patient_id,\n p_primary.policy_number AS primary_policy,\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.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NO...
[ { "role": "user", "content": "Can you list the wallet addresses and the amount held for the NFT with contract address '0xabcd...' and token ID '123'?" }, { "role": "assistant", "content": "SELECT wallet_address, amount FROM nft_holders WHERE contract_address = '0xabcd...' AND token_id = '123';" ...
You are an SQL statement expert. Given the table 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": "How many policy beneficiaries in the system have no contact information recorded?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM insurance.policy_beneficiaries WHERE contact_info 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 insurance.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, la...
[ { "role": "user", "content": "Show me the wallet ID and address for user 'user_abc'." }, { "role": "assistant", "content": "SELECT wallet_id, address FROM web3.wallets WHERE user_id = 'user_abc';" }, { "role": "user", "content": "Could you sort those wallets by their creation date in...
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 text, user_id text, address text, private_key text, created...
[ { "role": "user", "content": "Show the total number of appointments created in 2024 for each doctor and each status." }, { "role": "assistant", "content": "SELECT doctor_id, status, COUNT(*) AS appointment_count FROM healthcare.appointments WHERE EXTRACT(YEAR FROM created_at) = 2024 GROUP BY doc...
You are an SQL statement expert. Given the table 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, patient_id character varying(64) NOT NULL, doc...
[ { "role": "user", "content": "Show me all token names and their contract addresses along with the wallet addresses of users who created wallets in the last 30 days, sorted by wallet creation date." }, { "role": "assistant", "content": "SELECT t.token_name, t.contract_address, w.address AS wallet...
You are an SQL statement expert. Given the table 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": "I need the full names of guests who have checked out in June 2023. Show reservation_id, guest first and last name, property_id and actual_check_out_ts." }, { "role": "assistant", "content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS full_name, 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 hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "Count the total number of unique insurance providers in the system." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT insurance_provider) FROM healthcare.insurance_plans;" } ]
You are an SQL statement expert. Given the table 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 all maintenance logs that include an odometer reading, showing the log ID, service date, service type, cost, and the recorded odometer value, specifically for services costing between 100 and 500." }, { "role": "assistant", "content": "SELECT log_id, service_da...
You are an SQL statement expert. Given the table 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.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "What is the total amount of all payments recorded?" }, { "role": "assistant", "content": "SELECT SUM(amount) FROM government_services.payments;" }, { "role": "user", "content": "Now only include payments with status 'Completed'." }, { "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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Show me all passengers who have made bookings with special requests, along with their contact information and the count of such bookings." }, { "role": "assistant", "content": "SELECT p.passenger_id, p.first_name, p.last_name, p.email, p.phone_number, COUNT(b.bookin...
You are an SQL statement expert. Given the table 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": "Show me pairs of claims filed for the same policy, including the claim IDs and incident dates for both claims." }, { "role": "assistant", "content": "SELECT\n c1.claim_id AS claim1_id,\n c1.incident_date AS claim1_incident_date,\n c2.claim_id AS claim2_id,\n c2....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, -- unique identifier for the claim policy_id charac...
[ { "role": "user", "content": "For each claim, show the corresponding product_type of the insurance product for the related policy." }, { "role": "assistant", "content": "SELECT cl.claim_id, ip.product_type\nFROM insurance.claims cl\nJOIN insurance.policies p ON cl.policy_id = p.policy_id\nJOIN 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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "Show me the full name and email of each client along with the subject and location of all appointments they have, and include the name of the lawyer for each appointment." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS client_full...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad...
[ { "role": "user", "content": "Show me all savings accounts (account_id, account_number, balance) with an interest rate above 2.5%, along with the security details (ticker_symbol, issuer_name) for securities in the same currency as the account." }, { "role": "assistant", "content": "SELECT a.acco...
You are an SQL statement expert. Given the table 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 token symbol, token name, and contract address for all tokens that have no recorded transfers in the token_transfers table." }, { "role": "assistant", "content": "SELECT T.token_symbol, T.token_name, T.contract_address FROM web3.tokens AS T LEFT JOIN token_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address cha...
[ { "role": "user", "content": "Get the usernames of users who have created any public posts, and count how many public posts each user has made. Order the results by the post count in descending order." }, { "role": "assistant", "content": "SELECT u.username, COUNT(p.post_id) AS public_post_count...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "List all securities (security_id, ticker_symbol, security_name) that have a currency of 'EUR' and were last updated within the last 30 days, along with their exchange and sector information." }, { "role": "assistant", "content": "SELECT security_id, ticker_symbol, 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 financial_services.securities ( security_id character varying(64) NOT NULL, -- unique identifier for the security ...
[ { "role": "user", "content": "Show the first and last names of citizens who appear in both the appointments table and the payments table." }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name , T1.last_name FROM government_services.citizens AS T1 JOIN government_services.appointm...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "role": "user", "content": "List all wallets along with their user IDs, but only for wallets created in 2023." }, { "role": "assistant", "content": "SELECT wallet_id, user_id, address, created_at FROM web3.wallets WHERE created_at BETWEEN '2023-01-01' AND '2023-12-31';" }, { "role": "u...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "List the document ID, document type, upload timestamp, and the full name of the employee who verified it for all documents that have been verified." }, { "role": "assistant", "content": "SELECT d.document_id, d.document_type, d.upload_timestamp, CONCAT(e.first_name,...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document i...
[ { "role": "user", "content": "List all cryptocurrency assets that have been traded more than 50 times but have an average trade quantity less than 10." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count, AVG(t.quantity) AS avg_quantity FRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "List all pairs of drivers whose license_expiry_date falls in the same month and year. Display the first and last names of both drivers as driver1_first, driver1_last, driver2_first, driver2_last, and the shared year and month as expiry_year and expiry_month." }, { "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 transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Give me a breakdown of the number of reviews per day for the last 14 days, including the review_date and review count." }, { "role": "assistant", "content": "SELECT DATE(review_date) AS review_day, COUNT(*) AS review_count\nFROM hospitality_technology.reviews\nWHERE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reviews ( review_id text, property_id text, reservation_id text, guest_id text, rating_overall i...
[ { "role": "user", "content": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their token symbol and narrative from the smart_money_token_inflow table." }, { "role": "assistant", "content": "SELECT token_symbol, narrative, usd_value FROM smart_mon...
You are an SQL statement expert. Given the table 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": "Can you show me the user IDs and their theme settings for all users who have enabled email notifications and have updated their settings in 2024?" }, { "role": "assistant", "content": "SELECT user_id, theme FROM social_media.user_settings WHERE email_notifications_e...
You are an SQL statement expert. Given the table 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.user_settings ( setting_id text PRIMARY KEY, user_id text, theme text, email_notifications_enabled bool, p...
[ { "role": "user", "content": "How many documents were uploaded in the year 2023?" }, { "role": "assistant", "content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "role": "user", "content": "List all hashtags and for each, show how many different users have created posts using that hashtag." }, { "role": "assistant", "content": "SELECT ph.hashtag_id, COUNT(DISTINCT p.user_id) AS unique_user_count\nFROM social_media.post_hashtags ph\nJOIN social_media.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": "Find the wallet address, user ID, and the contract address of any contract where that wallet is listed as the deployer." }, { "role": "assistant", "content": "SELECT w.address AS wallet_address, w.user_id, c.address AS contract_address\nFROM web3.wallets w\nJOIN web...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "For each reservation, find the next reservation made by the same guest and calculate the gap in days between them." }, { "role": "assistant", "content": "select r1.reservation_id as current_reservation_id, r2.reservation_id as next_reservation_id, r2.check_in_date -...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r...
[ { "role": "user", "content": "For each server, show its name and the total number of achievements available for the game it hosts." }, { "role": "assistant", "content": "SELECT s.server_name, s.region, COUNT(a.achievement_id) AS achievement_count\nFROM gaming_technology.servers s\nLEFT JOIN gami...
You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU...
[ { "role": "user", "content": "List all policies that have a coverage_limit exactly equal to the deductible. Show policy_id, policy_number, coverage_limit, and deductible." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, coverage_limit, deductible\nFROM insurance.policies\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Count the number of staff members for each position." }, { "role": "assistant", "content": "SELECT\n position,\n COUNT(staff_id) AS staff_count\nFROM hospitality_technology.staff\nGROUP BY\n position;" }, { "role": "user", "content": "Only show positi...
You are an SQL statement expert. Given the table 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": "List the first and last name of each citizen along with the city and state of the service location for their agency." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_serv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "How many users are registered in the system?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM blockchain.users;" }, { "role": "user", "content": "List the user ID and email for users whose email contains the string 'support'." }, { "ro...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.users ( user_id.text, username.text, email.text, password_hash.text )
[ { "role": "user", "content": "Show all doctors created before January 1st, 2023, listing their ID, first name, and last name." }, { "role": "assistant", "content": "SELECT\n doctor_id,\n first_name,\n last_name\nFROM\n healthcare.doctors\nWHERE\n created_at < '2023-01-01';" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Show me the names of all employees along with the names of the agencies they work for, and the number of appointments each employee has scheduled." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, a.agency_name, COUNT(appt.appointment_id) 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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "role": "user", "content": "List all security_ids that had at least one day where the high_price was more than 50% higher than the low_price, along with the maximum price difference (high_price - low_price) observed for each security and the corresponding data_timestamp." }, { "role": "assistant",...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.market_data ( data_point_id.bigint, security_id.text, data_timestamp.timestamp, open_price.numeric, ...
[ { "role": "user", "content": "Count how many appointments have been canceled at each location. Return the location and cancelled_count." }, { "role": "assistant", "content": "SELECT location, COUNT(*) AS cancelled_count\nFROM legal_services.appointments\nWHERE status = 'Canceled'\nGROUP BY locat...
You are an SQL statement expert. Given the table 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": "List all developer names and their websites." }, { "role": "assistant", "content": "SELECT name, website FROM gaming_technology.developers;" }, { "role": "user", "content": "Can you only include developers whose website contains '.net'?" }, { "ro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_year.integer, website.text, created_...
[ { "role": "user", "content": "Show each trip's trip_id, scheduled_departure, actual_departure, the first and last name of the assigned driver, and the fare total collected from all bookings with that trip_id." }, { "role": "assistant", "content": "SELECT t.trip_id, t.scheduled_departure, t.actua...
You are an SQL statement expert. Given the table 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 ERC20 tokens from the `token_metas` table that have a total supply greater than 1 followed by 21 zeros. Show their contract address, symbol, name, and total supply." }, { "role": "assistant", "content": "SELECT contract_address, symbol, name, total_supply 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "For each player, list their username together with the titles of games they have any items from in their inventory." }, { "role": "assistant", "content": "SELECT DISTINCT p.username, g.title\nFROM gaming_technology.players p\nJOIN gaming_technology.player_inventory ...
You are an SQL statement expert. Given the table 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 usernames and the ID of the wallets they own." }, { "role": "assistant", "content": "SELECT t1.username, t2.wallet_id FROM blockchain.users AS t1 INNER JOIN blockchain.wallets AS t2 ON t1.user_id = t2.user_id;" }, { "role": "user", "content": "F...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, r...
[ { "role": "user", "content": "List all transactions where the status is 'failed' and the gas_used is greater than 100,000, including the transaction_id and timestamp." }, { "role": "assistant", "content": "SELECT transaction_id, timestamp FROM web3.transactions WHERE status = 'failed' AND gas_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 web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add...
[ { "role": "user", "content": "Show the record_id, patient_id, record_date and systolic blood pressure from vitals for all medical records where the systolic blood pressure is above 140." }, { "role": "assistant", "content": "SELECT record_id, patient_id, record_date, (vitals->>'systolic')::INT 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.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "How many participants are there in each conversation? Return conversation_id and participant_count." }, { "role": "assistant", "content": "SELECT conversation_id,\n COUNT(*) AS participant_count\nFROM social_media.conversation_participants\nGROUP BY conversati...
You are an SQL statement expert. Given the table 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.conversation_participants ( participant_id text, conversation_id text, user_id text, joined_at timestamp, ...
[ { "role": "user", "content": "Show me a list of users who have received notifications of type 'mention', along with their usernames and the notification creation time." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, n.notification_id, n.created_at\nFROM social_media.users u\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "Show me a list of all users who have participated in any trade (either as a buyer or a seller), including their username and the total number of trades they were involved in." }, { "role": "assistant", "content": "SELECT T1.username , count(T2.trade_id) FROM trading...
You are an SQL statement expert. Given the table 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": "For each blockchain (chain), find the token with the highest ROI in the smart_money_token_performance table, and include that token's narrative from smart_money_token_inflow, its net_flow, and avg_cost." }, { "role": "assistant", "content": "WITH ranked_tokens 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 smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,...
[ { "role": "user", "content": "Find pairs of notifications for the same citizen where one was sent via 'Email' and another via 'SMS'. Display citizen_id, email_notification_id, sms_notification_id, email_sent_at, and sms_sent_at." }, { "role": "assistant", "content": "SELECT e.citizen_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 government_services.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m...
[ { "role": "user", "content": "For each reservation, display the guest's full name, property_id, the total number of service orders placed, and the total price of those service orders." }, { "role": "assistant", "content": "SELECT r.reservation_id, g.first_name, g.last_name, r.property_id, COUNT(...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat...
[ { "role": "user", "content": "Find all smart contracts where the code length is greater than 1000 characters." }, { "role": "assistant", "content": "SELECT * FROM blockchain.smart_contracts WHERE LENGTH(code) > 1000;" }, { "role": "user", "content": "Now group these by creator_addres...
You are an SQL statement expert. Given the table 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": "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 all beneficiaries added in the last 6 months with a percentage share greater than 25%. Include their beneficiary ID, policy ID, customer ID, first name, last name, relationship, and percentage share. Order the results by the date they were added, oldest first." }, { ...
You are an SQL statement expert. Given the table 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.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, la...
[ { "role": "user", "content": "我想查询某个构建ID下的所有检查记录,包括检查类型、检查结果和检查时间,同时关联到对应的步骤信息。" }, { "role": "assistant", "content": "db.inspections.aggregate([\n {\n $match: {\n build_id: 'specific_build_id'\n }\n },\n {\n $lookup: {\n from: 'steps',\n localField: 'step_id',\n ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id...
[ { "role": "user", "content": "List each property with its manager's full name and the count of currently available services it offers." }, { "role": "assistant", "content": "SELECT p.property_id,\n p.property_name,\n CONCAT(m.first_name, ' ', m.last_name) AS manager_name,\n COU...
You are an SQL statement expert. Given the table 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": "Can you show me all prescriptions along with each patient's policy number and insurance plan ID?" }, { "role": "assistant", "content": "SELECT p.prescription_id, p.patient_id, p.medication_id, pi.policy_number, pi.plan_id\nFROM healthcare.prescriptions p\nJOIN healt...
You are an SQL statement expert. Given the table 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 text, record_id text, patient_id text, doctor_id text, medication_id text, d...
[ { "role": "user", "content": "List all follow IDs that were created on '2024-06-18'." }, { "role": "assistant", "content": "SELECT follow_id FROM social_media.follows WHERE DATE(created_at) = '2024-06-18';" } ]
You are an SQL statement expert. Given the table 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.follows ( follow_id.text, follower_user_id.text, following_user_id.text, created_at.timestamp )
[ { "role": "user", "content": "List all services provided by the property named 'Grand Plaza Hotel' and include their category and price." }, { "role": "assistant", "content": "SELECT T1.service_name, T1.category, T1.price FROM hospitality_technology.services AS T1 JOIN hospitality_technology.pro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL...
[ { "role": "user", "content": "Count how many insurance policies do not have a group number specified." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE group_number 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 healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p...
[ { "role": "user", "content": "I want to see for each security the ticker_symbol, security_name, and the highest single-day close_price from the market_data." }, { "role": "assistant", "content": "SELECT s.ticker_symbol, s.security_name, MAX(m.close_price) AS highest_close_price\nFROM financial_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 financial_services.transactions ( transaction_id text, account_id text, related_account_id text, transaction_type text,...
[ { "role": "user", "content": "List all ERC20 tokens where the price is greater than $10, including their names, symbols, and contract addresses." }, { "role": "assistant", "content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.contract_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "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": "Find all nodes that share the same IP address but have different node_ids." }, { "role": "assistant", "content": "SELECT n1.ip_address, n1.node_id as node_id1, n2.node_id as node_id2 FROM blockchain.nodes n1 JOIN blockchain.nodes n2 ON n1.ip_address = n2.ip_address ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
[ { "role": "user", "content": "List all terminated agents who worked for more than 5 years before termination, showing their full names and termination dates." }, { "role": "assistant", "content": "SELECT first_name, last_name, termination_date FROM insurance.agents WHERE status = 'Terminated' AN...
You are an SQL statement expert. Given the table 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, -- unique identifier for the agent first_name chara...
[ { "role": "user", "content": "List all pairs of lawyers with the same specialization." }, { "role": "assistant", "content": "SELECT l1.lawyer_id AS lawyer1_id,\n l1.first_name AS lawyer1_first_name,\n l1.last_name AS lawyer1_last_name,\n l2.lawyer_id AS lawyer2_id,\n l2.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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "What is the average daily trading volume for each security_id in the market_data table from the last 30 days?" }, { "role": "assistant", "content": "SELECT security_id, AVG(volume) as avg_daily_volume FROM financial_services.market_data WHERE data_timestamp >= CURRE...
You are an SQL statement expert. Given the table 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": "特定のラインIDに関連する組み立て手順と、使用されている材料の情報を取得したいです。ラインID、ステップ名、材料名、材料の説明を含めてください。" }, { "role": "assistant", "content": "SELECT s.line_id, s.step_name, m.material_name, m.description\nFROM manufacturing.assembly_steps s\nJOIN manufacturing.materials m ON s.step_id = m.materi...
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 manufacturing.materials ( material_id character varying(64) NOT NULL, -- unique...
[ { "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": "List the usernames and the IDs of conversations they have joined." }, { "role": "assistant", "content": "SELECT T1.username, T2.conversation_id FROM social_media.users AS T1 JOIN social_media.conversation_participants 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 social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "I need to find pairs of claims handled by the same claim handler where their incident dates are within 7 days of each other. For each pair, list claim_id1, claim_id2, claim_handler_id, and days_between." }, { "role": "assistant", "content": "SELECT c1.claim_id AS cl...
You are an SQL statement expert. Given the table 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": "What is the reason behind the cost variation for maintenance of asset_id 'ASSET456' over the past year?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the reasons behind cost variations for maintenance. The data in the maintenan...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.m...
[ { "role": "user", "content": "Could you list all employees along with the full name of their manager?" }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_name AS manager_name FROM financial_services.employees AS e LEFT ...
You are an SQL statement expert. Given the table 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...