conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "How many wallets were created in the year 2023?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM web3.wallets WHERE created_at >= '2023-01-01 00:00:00' AND created_at < '2024-01-01 00:00:00';" }, { "role": "user", "content": "Okay, instead of ...
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, -- unique identifier f...
[ { "role": "user", "content": "For each staff member, list their first name, last name, and their property ID." }, { "role": "assistant", "content": "SELECT first_name, last_name, property_id FROM hospitality_technology.staff" }, { "role": "user", "content": "Now, only show staff memb...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, -- unique identifier for the room ...
[ { "role": "user", "content": "Show the plan name and insurance provider for all insurance plans along with the total number of unique patients enrolled in each plan." }, { "role": "assistant", "content": "SELECT ip.plan_name, ip.insurance_provider, COUNT(DISTINCT pi.patient_id) AS enrolled_patie...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show me all maintenance logs for 'Oil Change' services performed in the last 3 months, including the vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_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.maintenance_logs ( log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ...
[ { "role": "user", "content": "What is the total sum of all amounts for all UTXOs in the system, regardless of whether they are spent or unspent?" }, { "role": "assistant", "content": "SELECT SUM(amount) FROM trading_platform.utxos" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ...
[ { "role": "user", "content": "For each contract, find the next contract deployed on the same network. Show the original contract_id, the next contract_id, network_id, and the time difference in hours between deployments." }, { "role": "assistant", "content": "SELECT\n c1.contract_id AS original...
You are an SQL statement expert. Given the table 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": "Show me all smart contracts created by addresses that have a balance greater than 1000, along with the contract creation timestamp." }, { "role": "assistant", "content": "SELECT sc.contract_id, sc.creator_address, sc.timestamp FROM blockchain.smart_contracts sc JOIN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic...
[ { "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 average_daily_volume\nFROM financial_services.market_data\nWHERE data_timestamp >=...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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 all nodes that were last seen in the past 7 days, along with the count of wallets associated with users who have the same IP address as these nodes." }, { "role": "assistant", "content": "SELECT n.node_id, n.ip_address, n.port, COUNT(w.wallet_id) AS wallet_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 blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic...
[ { "role": "user", "content": "List every guest along with every room type available in the system." }, { "role": "assistant", "content": "SELECT g.guest_id, g.first_name, g.last_name, rt.room_type_id, rt.type_name\nFROM hospitality_technology.guests g\nCROSS JOIN hospitality_technology.room_type...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, -- unique identifier for the room ...
[ { "role": "user", "content": "List all users who commented on posts tagged with hashtag 'spring', showing user_id, comment_id, content, and tag_name." }, { "role": "assistant", "content": "SELECT c.user_id, c.comment_id, c.content, h.tag_name\nFROM social_media.comments c\nJOIN social_media.post...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "Show each player's username along with the number of unique games they've played, and also include the total number of sessions for each player." }, { "role": "assistant", "content": "SELECT p.player_id, p.username, COUNT(DISTINCT gs.game_id) AS unique_games_played,...
You are an SQL statement expert. Given the table 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 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": "Show me each service order along with the next order placed by the same guest, including both order IDs and the time difference in minutes between the two orders." }, { "role": "assistant", "content": "SELECT a.order_id,\n b.order_id AS next_order_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 hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or...
[ { "role": "user", "content": "Show me all ERC20 token contracts that have had at least 200 approvals. Include the token symbol and total approval count." }, { "role": "assistant", "content": "SELECT m.contract_address, m.symbol, COUNT(*) AS approval_count\nFROM erc20_approval a\nJOIN token_metas...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "List all maintenance services performed on vehicle 'VHCL789', showing the service date and type." }, { "role": "assistant", "content": "SELECT service_date, service_type FROM transportation.maintenance_logs WHERE vehicle_id = 'VHCL789';" }, { "role": "user",...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.maintenance_logs ( log_id text PRIMARY KEY, vehicle_id text, service_date date, odometer_reading int, se...
[ { "role": "user", "content": "List addresses on the 'Ethereum' chain that have an ROI greater than 5 and a profit greater than $1000. Show their address, profit, ROI, and realized ratio." }, { "role": "assistant", "content": "SELECT address, profit, roi, realized_ratio FROM smart_money_profit WH...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_profit ( address text, rank numeric, profit numeric, roi numeric, realized_ratio numeric, most_profit_token...
[ { "role": "user", "content": "For each user, count how many different conversations they have participated in. Show user_id and conversation_count." }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT conversation_id) AS conversation_count\nFROM social_media.conversation_partici...
You are an SQL statement expert. Given the table 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 ) CREATE TAB...
[ { "role": "user", "content": "List all ERC20 tokens (from token_metas) that have 'Governance' in their name." }, { "role": "assistant", "content": "SELECT contract_address, symbol, name FROM token_metas WHERE is_erc20 = 1 AND name ILIKE '%Governance%';" }, { "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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Show me the top 3 narratives by trend rank, along with their top 3 tokens and 7-day price change percentage." }, { "role": "assistant", "content": "SELECT n.narrative, n.top_3_coins, n.price_change_percentage_7d FROM narrative_info n ORDER BY n.trend_rank ASC LIMIT ...
You are an SQL statement expert. Given the table 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, -- the id of the token token_name character varying(100) NO...
[ { "role": "user", "content": "List the first and last names of employees and the full name of the citizens for whom they have scheduled appointments." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , T3.first_name , T3.last_name FROM government_services.employees AS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Show me all patients who have been prescribed medications with dosage greater than 200mg, along with their full names and the medication details, including the prescribing doctor's last name." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, m...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List all staff members who have responded to at least one review in the last 6 months, including their first and last names and the count of responses." }, { "role": "assistant", "content": "SELECT s.staff_id, s.first_name, s.last_name, COUNT(r.review_id) AS respons...
You are an SQL statement expert. Given the table 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 subjects and start times of all appointments along with the document names of any documents uploaded for the associated case." }, { "role": "assistant", "content": "SELECT a.subject, a.start_time, d.document_name\nFROM legal_services.appointments a\nJOIN...
You are an SQL statement expert. Given the table 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": "List all pairs of hashtags that were created on the same date. Show both tag names and the creation date." }, { "role": "assistant", "content": "SELECT a.tag_name AS tag1, b.tag_name AS tag2, a.created_at::date AS created_date\nFROM social_media.hashtags a\nJOIN 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.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre...
[ { "role": "user", "content": "How many trips are there for each driver?" }, { "role": "assistant", "content": "SELECT driver_id, COUNT(*) AS trip_count FROM transportation.trips GROUP BY driver_id;" }, { "role": "user", "content": "Can you also show the total number of completed trip...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance ...
[ { "role": "user", "content": "List all group conversations that have at least one unread notification, include the conversation ID, group name, and the count of unread notifications as unread_count." }, { "role": "assistant", "content": "SELECT c.conversation_id, c.group_name, COUNT(n.notificati...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ...
[ { "role": "user", "content": "Show me all guests who have not provided their date of birth, along with their email if available, ordered by created date." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM hospitality_technology.guests WHERE date_of_birth IS NULL ORDE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil...
[ { "role": "user", "content": "Could you get the total spend on rare items for each player along with the player's username?" }, { "role": "assistant", "content": "SELECT p.player_id,\n p.username,\n SUM(pi.quantity * i.cost_amount) AS total_spend\nFROM gaming_technology.player_invent...
You are an SQL statement expert. Given the table 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": "Find all pairs of lawyers who work for the same firm, showing each lawyer's first_name, last_name, email, and firm_id." }, { "role": "assistant", "content": "SELECT l1.first_name AS lawyer1_first_name,\n l1.last_name AS lawyer1_last_name,\n l1.email AS l...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "Find all pairs of lawyers from the same firm who have the same specialization." }, { "role": "assistant", "content": "SELECT a.lawyer_id AS lawyer_id_1, a.first_name AS first_name_1, a.last_name AS last_name_1, b.lawyer_id AS lawyer_id_2, b.first_name AS 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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "role": "user", "content": "List the top 5 tokens by price_change_percentage_7d, showing token_symbol, narrative, and price_change_percentage_7d." }, { "role": "assistant", "content": "SELECT token_symbol, narrative, price_change_percentage_7d\nFROM token_basic_info\nORDER BY price_change_perc...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.text, chain.text, price.numeric, pri...
[ { "role": "user", "content": "List each citizen's first and last name alongside the first and last name of another citizen born in the same year but with a different national ID number." }, { "role": "assistant", "content": "SELECT c1.first_name AS first_name_1,\n c1.last_name AS last_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.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "For each customer, show their full name, account number, account balance, and the ticker symbol of securities they have traded." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS full_name, a.account_number, a.balance, s.ticker_symbo...
You are an SQL statement expert. Given the table 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 smart money addresses that have a negative PNL but a positive Realized Ratio. Show the address, chain, PNL, and Realized Ratio." }, { "role": "assistant", "content": "SELECT token_address, chain, pnl, realized_ratio FROM smart_money_token_performance WHERE ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address.text, token_symbol.text, pnl.numeric, net_flow.numeric, avg_cost.numeric,...
[ { "role": "user", "content": "List all services with an average processing time greater than the overall average processing time for all services. Show the service name, average processing time, and the overall average processing time." }, { "role": "assistant", "content": "SELECT service_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.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "For each route type, show the total number of trips taken and the total distance covered across all trips for that type." }, { "role": "assistant", "content": "SELECT T1.type, COUNT(T2.trip_id), SUM(T1.distance_km) FROM transportation.routes AS T1 JOIN transportatio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "Could you list projects that have completed more than one fundraising round, showing the project name and the number of rounds?" }, { "role": "assistant", "content": "SELECT project_name, COUNT(*) AS round_count FROM project_fundraising_record GROUP BY project_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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Show me all doctors who have prescribed medications with a dosage greater than 200mg, along with their specialties and the count of such prescriptions per doctor." }, { "role": "assistant", "content": "SELECT d.doctor_id, d.first_name, d.last_name, d.specialty, COUN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number...
[ { "role": "user", "content": "Show me all unique player IDs who have at least one item in their inventory with a quantity greater than 10." }, { "role": "assistant", "content": "SELECT DISTINCT player_id FROM gaming_technology.player_inventory WHERE quantity > 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 gaming_technology.player_inventory ( inventory_id uuid, player_id uuid, item_id uuid, quantity integer, acquired_at tim...
[ { "role": "user", "content": "Show the total incoming and outgoing amounts for each account_id, along with the number of transactions for each type (incoming and outgoing). An incoming transaction is when the account_id appears as related_account_id." }, { "role": "assistant", "content": "SELECT...
You are an SQL statement expert. Given the table 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": "For each wallet, find the next wallet created by the same user. Return the user_id, the earlier wallet_id, the later wallet_id, and the time difference in minutes between their creation times." }, { "role": "assistant", "content": "SELECT user_id,\n wallet_id ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "Get each property's name, manager_staff_id, and the number of rooms with status 'OutOfOrder', including properties with zero OutOfOrder rooms." }, { "role": "assistant", "content": "SELECT p.property_name, p.manager_staff_id, COUNT(r.room_id) AS out_of_order_count\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "For claims reported after January 1st, 2024, show the claim ID, incident date, the policy number associated, and the full name of the agent who handled each claim." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, p.policy_id AS policy_numbe...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "Get the appointment details including appointment_id, the full name of the citizen, the service name, and scheduled_start_time for all appointments booked via 'Phone', ordered by scheduled_start_time descending." }, { "role": "assistant", "content": "SELECT a.appoin...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "List all premium payments made via credit card in the last 30 days, showing their policy IDs and payment amounts." }, { "role": "assistant", "content": "SELECT policy_id, amount_paid FROM insurance.premium_payments WHERE payment_method = 'credit card' AND payment_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 insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "Please find the number of transactions per account in November 2023, and list the account_number along with the transaction count." }, { "role": "assistant", "content": "SELECT a.account_number, COUNT(t.transaction_id) AS transaction_count\nFROM financial_services.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": "List all cryptocurrency assets that have wallet addresses associated with them." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol FROM trading_platform.assets a JOIN trading_platform.wallets w ON a.asset_id = w.asset_id WHERE a.type = 'crypt...
You are an SQL statement expert. Given the table 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": "Show each agency's name, jurisdiction level, and the count of its active services in the 'Healthcare' category." }, { "role": "assistant", "content": "SELECT a.agency_name, a.jurisdiction_level, COUNT(s.service_id) AS active_healthcare_services\nFROM 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 PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Find all pairs of drivers where one driver's license_expiry_date is earlier than another's. Return each pair's driver_ids, full names, and respective expiry dates." }, { "role": "assistant", "content": "SELECT d1.driver_id AS driver1_id, d1.first_name || ' ' || d1.l...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Show each user's username along with the number of conversations they have joined." }, { "role": "assistant", "content": "SELECT u.username, COUNT(cp.conversation_id) AS conversation_count\nFROM social_media.users u\nJOIN social_media.conversation_participants cp ON...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "List each payment method with the total payment amount and the latest payment_timestamp for that method." }, { "role": "assistant", "content": "SELECT payment_method, SUM(amount) AS total_amount, MAX(payment_timestamp) AS latest_payment\nFROM hospitality_technology....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu...
[ { "role": "user", "content": "List all claims with their beneficiary first and last names and their percentage share." }, { "role": "assistant", "content": "SELECT c.claim_id, pb.first_name, pb.last_name, pb.percentage_share\nFROM insurance.claims c\nJOIN insurance.policy_beneficiaries pb ON c.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.claims ( claim_id character varying(64) NOT NULL, -- unique identifier for the claim policy_id charac...
[ { "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": "Can you help me retrieve the details of passengers who are part of a specific loyalty program with ID 'LOYALTY123'?" }, { "role": "assistant", "content": "db.passengers.find({ loyalty_program_id: 'LOYALTY123' }, { first_name: 1, last_name: 1, email: 1, phone_number:...
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 // db.createCollection('passengers') // Optional: db.passengers.createIndex({ passenger_id: 1 }, ...
[ { "role": "user", "content": "List all medications whose manufacturer field is not null." }, { "role": "assistant", "content": "SELECT medication_id, medication_name, generic_name, manufacturer, ndc_code, description\nFROM healthcare.medications\nWHERE manufacturer IS NOT NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "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 the date worked, hours spent, and description for all time entries that have not yet been billed." }, { "role": "assistant", "content": "SELECT date_worked , hours_spent , description FROM time_entries WHERE is_billed = false" }, { "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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "I need to find pairs of players from the same country but with different statuses. Show their usernames, country code, and status for both players in the pair." }, { "role": "assistant", "content": "SELECT p1.username AS player1_username, p2.username AS player2_user...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "List the policy number, start date, product name, and base premium for policies where the base premium of the associated product is greater than 1000." }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.start_date, T2.product_name, T2.base_premium FRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "Get me the total number of vehicles for each fuel_type." }, { "role": "assistant", "content": "SELECT fuel_type,\n COUNT(*) AS total_vehicles\nFROM transportation.vehicles\nGROUP BY fuel_type;" }, { "role": "user", "content": "Only show fuel types ...
You are an SQL statement expert. Given the table 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": "Find all pairs of drivers who were hired on the same date. For each pair, show the first_name and last_name of both drivers as driver1_first, driver1_last, driver2_first, driver2_last, and their shared hire_date." }, { "role": "assistant", "content": "SELECT d1.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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens...
[ { "role": "user", "content": "Show me all customers (customer_id, first_name, last_name) from California (state = 'CA') who have made trades in the last 30 days, along with the total trade amount for each customer." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.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 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 Sui NFT collections with the highest number of unique owners, along with their names and collection types." }, { "role": "assistant", "content": "SELECT name, collection_type, COUNT(DISTINCT owner) AS unique_owners FROM sui_nfts WHERE owner IS NOT ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number.bigint, block_timestamp.timestamp, transaction_index.integer, transaction_hash....
[ { "role": "user", "content": "List all pairs of achievements unlocked by the same player, showing player_id, achievement1, and achievement2." }, { "role": "assistant", "content": "SELECT pa1.player_id,\n pa1.achievement_id AS achievement1,\n pa2.achievement_id AS achievement2\nFROM g...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti...
[ { "role": "user", "content": "For each asset, show its name and symbol, and the total number of completed orders that have resulted in at least one trade." }, { "role": "assistant", "content": "SELECT a.name, a.symbol, COUNT(DISTINCT o.order_id) AS completed_order_count\nFROM trading_platform.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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "Show me all claims with police reports that were filed in the last 3 months, along with the policy details and customer information." }, { "role": "assistant", "content": "SELECT c.claim_id, c.policy_id, c.customer_id, c.incident_date, c.reported_date, c.description...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ...
[ { "role": "user", "content": "Could you list each employee along with their manager’s full name?" }, { "role": "assistant", "content": "SELECT e.employee_id, e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_name AS manager_name\nFROM financial_services.employees...
You are an SQL statement expert. Given the table 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.employees ( employee_id text, first_name text, last_name text, job_title text, department text, bran...
[ { "role": "user", "content": "Show me the top 5 assets by the number of actions logged in the trading platform, along with their types." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.type, COUNT(l.log_id) AS action_count FROM trading_platform.assets a JOIN trading_platform.l...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.assets ( asset_id text, name text, symbol text, type text ) CREATE TABLE trading_platform.logs ( log_i...
[ { "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": "Show the usernames and email addresses of all users who have never created a post." }, { "role": "assistant", "content": "SELECT u.username, u.email\nFROM social_media.users u\nLEFT JOIN social_media.posts p ON u.user_id = p.user_id\nWHERE p.post_id IS NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "For each property, show the property_name, the total number of available services, and the average price of those services." }, { "role": "assistant", "content": "SELECT p.property_name,\n COUNT(s.service_id) AS total_available_services,\n AVG(s.price) 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 PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "List all node pairs that operate on the same port and were last_seen within 30 minutes of each other, showing both node_ids, the port, and the time difference in minutes." }, { "role": "assistant", "content": "SELECT n1.node_id AS node1_id, n2.node_id AS node2_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 blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
[ { "role": "user", "content": "Find all patients who have both an emergency contact and a phone number, and show their full names along with the emergency contact name and phone number, sorted by last name." }, { "role": "assistant", "content": "SELECT CONCAT(first_name, ' ', last_name) AS patien...
You are an SQL statement expert. Given the table 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 appointment IDs, times, patient full name, and doctor full name for all appointments scheduled in February 2024." }, { "role": "assistant", "content": "SELECT T1.appointment_id, T1.appointment_time, T2.first_name, T2.last_name, T3.first_name, T3.last_name 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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "For each SUI coin type, show the total balance across all owners and the number of distinct owners." }, { "role": "assistant", "content": "SELECT\n coin_type,\n SUM(CAST(balance AS DECIMAL)) AS total_balance,\n COUNT(DISTINCT owner) AS owner_count\nFROM sui_coins...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "List all users who have deployed contracts, along with their email addresses and the count of contracts they've deployed." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, COUNT(c.contract_id) AS contract_count FROM web3.users u JOIN web3.contracts 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 web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "What is the average balance of all addresses in the database?" }, { "role": "assistant", "content": "SELECT AVG(balance) as average_balance FROM blockchain.addresses;" }, { "role": "user", "content": "Can you break this down by the first 3 characters 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 blockchain.addresses ( address_id.text, public_key.text, balance.numeric )
[ { "role": "user", "content": "List all Bitcoin token ticks and their creators from token_info_bitcoin." }, { "role": "assistant", "content": "SELECT tick, creator\nFROM token_info_bitcoin;" }, { "role": "user", "content": "Include the total amount held by all wallets for each tick fr...
You are an SQL statement expert. Given the table 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 all active policies with coverage limits above $500,000, along with the customer names and agent names, sorted by coverage limit in descending order." }, { "role": "assistant", "content": "SELECT p.policy_id, p.coverage_limit, c.first_name AS customer_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.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "Find pairs of claim documents for the same claim where the upload time difference is less than 5 minutes. List the document IDs of the pairs and the claim ID." }, { "role": "assistant", "content": "SELECT a.document_id AS document1_id, b.document_id AS document2_id,...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id.text, claim_id.text, document_type.text, file_name.text, file_path.text, file_s...
[ { "role": "user", "content": "Which rooms on the 4th floor are non-smoking, along with their property IDs and type IDs?" }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number, room_type_id FROM hospitality_technology.rooms WHERE floor = 4 AND is_smoking = 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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room...
[ { "role": "user", "content": "List all active employees (employee_id, first_name, last_name, department) who were hired in the last 5 years and work in either the 'Investment' or 'Trading' department, sorted by hire_date in descending order." }, { "role": "assistant", "content": "SELECT employee...
You are an SQL statement expert. Given the table 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": "Find patients who currently have both a primary and a secondary insurance policy. For each, show patient_id, full name, primary policy_number, and secondary policy_number." }, { "role": "assistant", "content": "SELECT p.patient_id,\n p.first_name || ' ' || p.l...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List pairs of routes where the destination of one route matches the origin of another route." }, { "role": "assistant", "content": "SELECT r1.route_number AS route_1, r2.route_number AS route_2 FROM transportation.routes r1 JOIN transportation.routes r2 ON r1.destin...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "How many customers are there for each status?" }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM financial_services.customers GROUP BY status" }, { "role": "user", "content": "Only show statuses where the count is greater than 50." }, ...
You are an SQL statement expert. Given the table 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": "Retrieve all prescriptions linked to chronic diagnoses. Show prescription_id, diagnosis_id, diagnosis_code, and prescription_date." }, { "role": "assistant", "content": "SELECT pr.prescription_id,\n d.diagnosis_id,\n d.diagnosis_code,\n pr.prescrip...
You are an SQL statement expert. Given the table 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 a list of all users who have made posts that are set to 'private' visibility. Include their user_id, post_id, post creation time, and the user's current theme." }, { "role": "assistant", "content": "SELECT p.user_id, p.post_id, p.created_at, us.theme\nFROM 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 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 the top 5 users who have created the most wallets, along with their email addresses and the total number of wallets they created." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, COUNT(w.wallet_id) AS wallet_count FROM trading_platform.users...
You are an SQL statement expert. Given the table 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": "Provide the contract ID, creator address, and timestamp for all smart contracts created between January 1st, 2022, and December 31st, 2024." }, { "role": "assistant", "content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE ti...
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.smart_contracts ( contract_id.text, creator_address.text, code.text, time...
[ { "role": "user", "content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a security_type of 'Equity'." }, { "role": "assistant", "content": "SELECT security_id, ticker_symbol, security_name FROM financial_services.securities WH...
You are an SQL statement expert. Given the table 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 all 'exists'-status coins from sui_coins_metadata with more than 8 decimals, showing coin_type, symbol, name, and decimals." }, { "role": "assistant", "content": "SELECT coin_type, symbol, name, decimals FROM sui_coins_metadata WHERE status = 'exists' AND decim...
You are an SQL statement expert. Given the table 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": "List the plan name and contact phone for all insurance plans of type 'HMO'." }, { "role": "assistant", "content": "SELECT plan_name, contact_phone\nFROM healthcare.insurance_plans\nWHERE plan_type = 'HMO';" } ]
You are an SQL statement expert. Given the table 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 PRIMARY KEY, plan_name text, insurance_provider text, plan_type text, contact...
[ { "role": "user", "content": "List each participant_id along with the total number of participants in their conversation, and include user_id and conversation_id." }, { "role": "assistant", "content": "SELECT cp.participant_id, cp.user_id, cp.conversation_id, counts.participant_count\nFROM socia...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.conversation_participants ( participant_id character varying(64) NOT NULL, -- unique identifier for th...
[ { "role": "user", "content": "Count how many diagnoses were recorded each month in 2024. Show the month (as the first day of the month) and the count." }, { "role": "assistant", "content": "SELECT DATE_TRUNC('month', diagnosis_date)::date AS diagnosis_month, COUNT(*) FROM healthcare.diagnoses WH...
You are an SQL statement expert. Given the table 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": "For each fundraising round, show the round name, the count of distinct projects, the total investment value, and the average current price of associated tokens. Match projects to tokens where project_name = token_name and sort by total investment descending." }, { "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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "List all pairs of overlapping reservations for the same room, including both reservation IDs, room ID, and each reservation's check-in and check-out dates." }, { "role": "assistant", "content": "SELECT r1.reservation_id AS reservation1_id,\n r2.reservation_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.reservations ( reservation_id.text, property_id.text, guest_id.text, room_id.text, room_type_id....
[ { "role": "user", "content": "Show me the total quantity traded and total amount for each security, identified by its ticker symbol, for trades in the last month." }, { "role": "assistant", "content": "SELECT T2.ticker_symbol, SUM(T1.quantity), SUM(T1.total_amount) FROM financial_services.trades...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit...
[ { "role": "user", "content": "Can you list for each player their most recent and second most recent achievements, showing columns player_id, recent_achievement_id, second_recent_achievement_id, and recent_unlocked_at?" }, { "role": "assistant", "content": "SELECT recent.player_id,\n recent...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N...
[ { "role": "user", "content": "List each partner lawyer's first_name, last_name along with the count of invoices for the cases they lead." }, { "role": "assistant", "content": "SELECT l.lawyer_id, l.first_name, l.last_name, COUNT(i.invoice_id) AS invoice_count\nFROM legal_services.lawyers l\nJOIN...
You are an SQL statement expert. Given the table 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...