conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "List all doctors who have prescribed medications with frequency 'Once daily', along with their specialties and the count of such prescriptions per doctor." }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, d.specialty, COUNT(pr.prescription_id)...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "How many users in total have a profile picture URL specified?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.users WHERE profile_picture_url IS NOT NULL" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Show me all appointments that have both a non-null location and notes, along with their appointment_id, client_id, lawyer_id, and start_time." }, { "role": "assistant", "content": "SELECT appointment_id, client_id, lawyer_id, start_time FROM legal_services.appointme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "List all premium payments that are currently overdue (status = 'overdue'), showing their policy IDs and due dates." }, { "role": "assistant", "content": "SELECT payment_id, policy_id, due_date FROM insurance.premium_payments WHERE status = 'overdue';" }, { "...
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo...
[ { "role": "user", "content": "List tokens on the 'Arbitrum' chain with a 24-hour trading volume greater than 1,000,000 USD. Show symbol, volume, and price." }, { "role": "assistant", "content": "SELECT token_symbol, volume_24h, price FROM token_dexpool_info WHERE chain = 'Arbitrum' AND volume_24...
You are an SQL statement expert. Given the table 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_dexpool_info ( pair_address character varying(512) NOT NULL, token_name character varying(100) NOT NULL, token_sy...
[ { "role": "user", "content": "Who are the top 3 agents with the highest commission rate? Show their full names and commission rates." }, { "role": "assistant", "content": "SELECT first_name, last_name, commission_rate\nFROM insurance.agents\nORDER BY commission_rate DESC\nLIMIT 3;" }, { ...
You are an SQL statement expert. Given the table 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": "What is the maintenance schedule for platform 3 at station DEF for the next month?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to the maintenance schedule for platforms. The data I have only includes static information about platform de...
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.p...
[ { "role": "user", "content": "Provide a count of citizens registered per calendar year." }, { "role": "assistant", "content": "SELECT CAST(EXTRACT(YEAR FROM registration_date) AS INTEGER) AS registration_year, COUNT(*) AS citizen_count FROM government_services.citizens GROUP BY 1 ORDER BY 1;" ...
You are an SQL statement expert. Given the table 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": "Retrieve the number of distinct guests for each service order status." }, { "role": "assistant", "content": "SELECT status, COUNT(DISTINCT guest_id) AS guest_count\nFROM hospitality_technology.service_orders\nGROUP BY status;" }, { "role": "user", "conte...
You are an SQL statement expert. Given the table 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 case number, case name, and the full name of the client for cases that have uploaded documents." }, { "role": "assistant", "content": "SELECT T1.case_number , T1.case_name , T2.full_name FROM legal_services.cases AS T1 JOIN legal_services.clients AS T2 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 legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u...
[ { "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": "Which users have received both a comment notification and a like notification? List the recipient_user_id and the total number of such users." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT recipient_user_id) AS user_count\nFROM (\n SELECT recipient_us...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.likes ( like_id character varying(64) NOT NULL, -- unique identifier for the like user_id characte...
[ { "role": "user", "content": "Show all contracts that share the same deployment date, along with their contract IDs and the corresponding deployment date." }, { "role": "assistant", "content": "SELECT a.contract_id AS contract_id_1, b.contract_id AS contract_id_2, a.deployed_at::date AS deployme...
You are an SQL statement expert. Given the table 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": "List tokens on the 'Arbitrum' chain with a 24-hour price change percentage greater than 10% and a market cap above 1,000,000 USD. Show their symbol, name, price, 24-hour change percentage, and market cap. Order the results by the 24-hour change percentage in descending order." ...
You are an SQL statement expert. Given the table 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 all claim documents where the file name contains 'invoice' (case insensitive), showing the document ID, claim ID, file name, and uploaded_at." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name, uploaded_at\nFROM insurance.claim_docum...
You are an SQL statement expert. Given the table 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": "Find pairs of conversations that were created on the same calendar date, showing their IDs and the shared creation date." }, { "role": "assistant", "content": "SELECT c1.conversation_id AS conversation1_id, c2.conversation_id AS conversation2_id, c1.created_at::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 social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR...
[ { "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": "For each user, find the next user who registered after them. Return the first user's user_id and username, the second user's user_id and username, and the time difference in hours." }, { "role": "assistant", "content": "SELECT\n u1.user_id AS user1_id,\n u1.userna...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
[ { "role": "user", "content": "List all drivers who have completed more than 20 trips in the past month." }, { "role": "assistant", "content": "SELECT driver_id, COUNT(*) AS trip_count FROM transportation.trips WHERE status = 'completed' AND actual_departure >= CURRENT_DATE - INTERVAL '1 month' 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 transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var...
[ { "role": "user", "content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts." }, { "role": "assistant", "content": "SELECT address, deployer_address FROM web3.contracts WHERE address = deployer_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 earliest unlock date for each achievement along with the player_id who unlocked it." }, { "role": "assistant", "content": "SELECT achievement_id, player_id, MIN(unlocked_at) AS earliest_unlock FROM gaming_technology.player_achievements GROUP BY achieveme...
You are an SQL statement expert. Given the table 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": "Show me each guest's total payment amount and total number of reservations, including their guest_id. Only include guests who have at least two reservations." }, { "role": "assistant", "content": "SELECT r.guest_id, SUM(p.amount) AS total_payment_amount, COUNT(DISTI...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r...
[ { "role": "user", "content": "For all chains, which token held by centralized exchanges (CEX) has the highest ROI according to smart money token performance? Show token symbol, chain, exchange, total USD value held on CEX, and the smart money ROI." }, { "role": "assistant", "content": "SELECT c....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "Show me all creator addresses that deployed smart contracts exactly on February 14th, 2023." }, { "role": "assistant", "content": "SELECT DISTINCT creator_address\nFROM blockchain.smart_contracts\nWHERE timestamp::date = '2023-02-14';" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.smart_contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the smart contra...
[ { "role": "user", "content": "I need to find pairs of clients who work for the same company, showing each pair's full names and the company name." }, { "role": "assistant", "content": "SELECT c1.company_name, CONCAT(c1.first_name, ' ', c1.last_name) AS client1_name, CONCAT(c2.first_name, ' ', c2...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "List all maintenance logs for vehicles that had 'Tire Rotation' service in the last 6 months, showing vehicle ID and service date." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date FROM transportation.maintenance_logs WHERE service_type = 'Tire ...
You are an SQL statement expert. Given the table 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 SUI coins that have the status 'inactive', including their owner address and coin_type." }, { "role": "assistant", "content": "SELECT coin_type, owner FROM sui_coins WHERE status = 'inactive';" }, { "role": "user", "content": "Add the name and 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Provide each trip's ID, vehicle license plate, driver's full name, origin city, and destination city." }, { "role": "assistant", "content": "SELECT t.trip_id,\n v.license_plate,\n CONCAT(d.first_name, ' ', d.last_name) AS driver_name,\n lo.city 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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "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": "List each customer's account in one currency along with another account in a different currency, showing customer_id, account_primary, currency_primary, account_secondary, and currency_secondary." }, { "role": "assistant", "content": "SELECT a.customer_id, a.account...
You are an SQL statement expert. Given the table 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": "Show me the user ID and the total count of wallets associated with each user who owns at least one wallet." }, { "role": "assistant", "content": "SELECT T1.user_id, COUNT(T2.wallet_id) FROM trading_platform.users AS T1 JOIN trading_platform.wallets AS T2 ON T1.user_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp ) CREATE TAB...
[ { "role": "user", "content": "How many time entries were recorded on each date? List the date and the count of entries for that date, ordered by date." }, { "role": "assistant", "content": "SELECT date_worked, COUNT(*) AS entry_count FROM legal_services.time_entries GROUP BY date_worked ORDER BY...
You are an SQL statement expert. Given the table 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.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu...
[ { "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": "Get total 'sell' order quantities per user_id." }, { "role": "assistant", "content": "SELECT user_id,\n SUM(quantity) AS total_sold\nFROM trading_platform.orders\nWHERE order_type = 'sell'\nGROUP BY user_id;" }, { "role": "user", "content": "Now, o...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Please show me the first name, last name, and date of birth for all passengers born between 1990 and 1999, inclusive." }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth FROM transportation.passengers WHERE date_of_birth BETWEEN '1990-...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, ...
[ { "role": "user", "content": "Which room types have the highest average base_rate? Return type_name and avg_rate, sorted descending, limit 5." }, { "role": "assistant", "content": "SELECT rt.type_name,\n AVG(rt.base_rate) AS avg_rate\nFROM hospitality_technology.room_types rt\nGROUP BY rt....
You are an SQL statement expert. Given the table 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": "I need to find all pairs of diagnoses for the same patient where one diagnosis is chronic and the other is non-chronic. Show patient_id, chronic diagnosis_id as chronic_id, non-chronic diagnosis_id as acute_id, chronic diagnosis_date, and acute diagnosis_date." }, { "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 healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry ...
[ { "role": "user", "content": "Show me all active policies for customers who live in New York, along with their total premium payments made so far, and include the agent's full name." }, { "role": "assistant", "content": "SELECT p.policy_id, p.policy_number, p.start_date, p.end_date, p.premium_am...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Show me all users who started following someone in May 2024, along with both the user ID of the follower and the followed user." }, { "role": "assistant", "content": "SELECT follower_user_id, following_user_id\nFROM social_media.follows\nWHERE created_at >= '2024-05...
You are an SQL statement expert. Given the table 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": "Give me the number of patient insurance policies for each plan where the policy is currently active. Return plan_id and policy_count." }, { "role": "assistant", "content": "SELECT\n plan_id,\n COUNT(*) AS policy_count\nFROM healthcare.patient_insurance\nWHERE (exp...
You are an SQL statement expert. Given the table 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": "List the token symbol, USD value, and narrative for all smart money token inflows." }, { "role": "assistant", "content": "SELECT token_symbol, usd_value, narrative FROM smart_money_token_inflow;" }, { "role": "user", "content": "Now, only show entries wh...
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 smart_money_token_inflow ( token_address text, token_symbol text, token_amount numer...
[ { "role": "user", "content": "Show all SUI coins with 'exists' status and more than 8 decimal places. Display coin_type, symbol, name, and decimals." }, { "role": "assistant", "content": "SELECT coin_type, symbol, name, decimals\nFROM sui_coins_metadata\nWHERE status = 'exists' AND decimals > 8;...
You are an SQL statement expert. Given the table 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_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_i...
[ { "role": "user", "content": "List the tokens on the BSC chain that have a positive price change in the last 24 hours and a market cap over $10,000,000. Show the symbol, price, and market cap." }, { "role": "assistant", "content": "SELECT token_symbol, price, market_cap\nFROM token_basic_info\nW...
You are an SQL statement expert. Given the table 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...
[ { "role": "user", "content": "Provide each pair of plans that share the same plan_type but are offered by different providers." }, { "role": "assistant", "content": "SELECT p1.plan_type,\n p1.plan_id AS plan1_id,\n p1.plan_name AS plan1_name,\n p1.insurance_provider AS provider...
You are an SQL statement expert. Given the table 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": "For each fuel type, show the number of unique vehicles that have used it and the total quantity refueled." }, { "role": "assistant", "content": "SELECT f.fuel_type, COUNT(DISTINCT f.vehicle_id) AS vehicle_count, SUM(f.quantity) AS total_quantity\nFROM transportation...
You are an SQL statement expert. Given the table 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": "For each security, find any other security within the same sector that has a later last_updated timestamp. Return a.ticker_symbol, b.ticker_symbol, and b.last_updated." }, { "role": "assistant", "content": "SELECT a.ticker_symbol AS symbol_a, b.ticker_symbol AS symb...
You are an SQL statement expert. Given the table 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 text, ticker_symbol text, isin_code text, cusip_code text, security_name te...
[ { "role": "user", "content": "For each agency that is a parent, how many direct child agencies does it have? Show the parent agency name and the count." }, { "role": "assistant", "content": "SELECT parent.agency_name AS parent_agency_name, COUNT(child.agency_id) AS child_agency_count FROM govern...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "Find any two policies for the same customer whose coverage dates overlap. Return the customer ID, both policy numbers, and their start and end dates." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.policy_number AS policy1_number,\n p1...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "List all reservations that have a total_amount greater than the amount_paid. Include the reservation_id, guest_id, total_amount, and amount_paid." }, { "role": "assistant", "content": "SELECT reservation_id, guest_id, total_amount, amount_paid\nFROM hospitality_tech...
You are an SQL statement expert. Given the table 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": "List all reservations made by guests from 'US', showing the reservation ID, guest first name, last name, and the property name." }, { "role": "assistant", "content": "SELECT T1.reservation_id, T2.first_name, T2.last_name, T3.property_name FROM 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.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "What are the average and maximum fare amounts for each booking status?" }, { "role": "assistant", "content": "SELECT status, AVG(fare) AS avg_fare, MAX(fare) AS max_fare\nFROM transportation.bookings\nGROUP BY status;" }, { "role": "user", "content": "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 transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, s...
[ { "role": "user", "content": "Show the ticker_symbol, security_name, and the number of loans that have that ticker_symbol as their collateral_description." }, { "role": "assistant", "content": "SELECT s.ticker_symbol, s.security_name, COUNT(l.loan_id) AS collateral_loan_count\nFROM financial_ser...
You are an SQL statement expert. Given the table 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": "Which agencies offer services with a standard fee greater than 100? List the agency name and the corresponding service names." }, { "role": "assistant", "content": "SELECT T1.agency_name, T2.service_name FROM government_services.agencies AS T1 INNER JOIN government_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "Show me the top 3 exchanges by total USD value of tokens held on the Ethereum chain, along with their top token by USD value from the cex_token_balance table." }, { "role": "assistant", "content": "WITH exchange_totals AS (SELECT exchange, SUM(usd_value) AS total_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 token_dexpool_info ( pair_address text, token_name text, token_symbol text, chain text, price numeric, price_change_per...
[ { "role": "user", "content": "Find all users whose usernames contain numbers and have email addresses from either Gmail or Yahoo." }, { "role": "assistant", "content": "SELECT user_id, username, email FROM blockchain.users WHERE username ~ '[0-9]' AND (email LIKE '%@gmail.com' OR email LIKE '%@y...
You are an SQL statement expert. Given the table 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, ip_address text, port integer, last_seen timestamp ) CREATE TABLE blockchain.users ( ...
[ { "role": "user", "content": "Show me the total count of 'approval for all' events for each ERC1155 collection on Ethereum. I need contract_address, collection name, and approval_count, sorted by approval_count descending." }, { "role": "assistant", "content": "SELECT e.contract_address,\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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "For each trade, show the buyer_id, seller_id, asset_id, quantity, and also include any metadata value where the key is 'exchange' for the asset involved." }, { "role": "assistant", "content": "SELECT t.buyer_id, t.seller_id, t.asset_id, t.quantity, m.value AS exchan...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.trades ( trade_id text, order_id text, buyer_id text, seller_id text, asset_id text, quantity numeric,...
[ { "role": "user", "content": "I want to know the total expenditure of each player on rare items, showing their player_id and total spent." }, { "role": "assistant", "content": "SELECT pi.player_id,\n SUM(igi.cost_amount * pi.quantity) AS total_spent\nFROM 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.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea...
[ { "role": "user", "content": "Show me all patients who have both a primary insurance plan and at least one completed appointment, along with their insurance policy numbers and the count of appointments." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.pol...
You are an SQL statement expert. Given the table 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 beneficiaries whose last name starts with 'S', including beneficiary_id, full name, and relationship." }, { "role": "assistant", "content": "SELECT beneficiary_id, first_name || ' ' || last_name AS full_name, relationship\nFROM insurance.policy_beneficiarie...
You are an SQL statement expert. Given the table 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, policy_id.text, customer_id.text, first_name.text, last_name.text...
[ { "role": "user", "content": "List all service orders, including the service name and quantity, along with the full name of the staff member who placed the order." }, { "role": "assistant", "content": "SELECT so.order_id, s.service_name, so.quantity, st.first_name, st.last_name FROM hospitality_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "Show me all guests from 'CA' along with their full name and email address." }, { "role": "assistant", "content": "SELECT guest_id, CONCAT(first_name, ' ', last_name) AS full_name, email FROM hospitality_technology.guests WHERE country_code = 'CA';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "List all guests who have made at least one reservation. Show their first and last names and the number of reservations they have made." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, COUNT(r.reservation_id) AS reservation_count\nFROM hospita...
You are an SQL statement expert. Given the table 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 events with their contract IDs and emitted timestamps, sorted by the most recent events first." }, { "role": "assistant", "content": "SELECT event_id, contract_id, emitted_at FROM web3.events ORDER BY emitted_at DESC;" }, { "role": "user", "cont...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_at.timestamp, transaction_id.text, l...
[ { "role": "user", "content": "Find employees who are managers and list the number of employees they directly manage. Show the manager's full name and the count of their direct reports." }, { "role": "assistant", "content": "SELECT m.first_name || ' ' || m.last_name AS manager_full_name, COUNT(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 government_services.employees ( employee_id character varying(64) NOT NULL, -- unique identifier for the government...
[ { "role": "user", "content": "How many hashtags have been created in March 2024?" }, { "role": "assistant", "content": "```sql\nSELECT COUNT(*) AS march_2024_hashtag_count\nFROM social_media.hashtags\nWHERE created_at >= '2024-03-01'\n AND created_at < '2024-04-01';\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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "Show me all maintenance logs for 'Oil Change' services performed in the last 6 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": "Retrieve each gender and the count of verified citizens born before 1990." }, { "role": "assistant", "content": "SELECT gender,\n COUNT(*) AS citizen_count\nFROM government_services.citizens\nWHERE is_verified = TRUE\n AND date_of_birth < '1990-01-01'\nGROUP ...
You are an SQL statement expert. Given the table 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": "What is the schedule of trains arriving at station with ID 'ST789' tomorrow?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide the train schedule for station ID 'ST789' as this information is not available in the current database. The table only ...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.s...
[ { "role": "user", "content": "List each child agency ID and name along with its parent agency ID and name." }, { "role": "assistant", "content": "SELECT c.agency_id AS child_id,\n c.agency_name AS child_name,\n p.agency_id AS parent_id,\n p.agency_name AS parent_name\nFROM gove...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "role": "user", "content": "Which services charge more than the average standard fee of their category? Show the service name, its fee, and the average fee for that category." }, { "role": "assistant", "content": "SELECT\n s.service_name,\n s.standard_fee,\n avg_fees.avg_fee\nFROM governmen...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli...
[ { "role": "user", "content": "I need to get the count of appointments grouped by their status." }, { "role": "assistant", "content": "SELECT a.status, \n COUNT(*) AS appointment_count\nFROM legal_services.appointments a\nGROUP BY a.status;" }, { "role": "user", "content": "Only...
You are an SQL statement expert. Given the table 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": "Retrieve all orders placed after '2024-06-01', including order_id, user_id, asset_id, quantity, and price." }, { "role": "assistant", "content": "SELECT order_id, user_id, asset_id, quantity, price\nFROM trading_platform.orders\nWHERE created_at > '2024-06-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 trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "List each narrative along with the token that has the highest current price and the token that has the lowest current price from the token_basic_info table." }, { "role": "assistant", "content": "WITH ranked_high AS (\n SELECT narrative, token_symbol, price,\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 token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri...
[ { "role": "user", "content": "For each room, find the next higher room_number on the same floor and property. Show room_id, property_id, floor, room_number, next_room_id, next_room_number." }, { "role": "assistant", "content": "SELECT r1.room_id,\n r1.property_id,\n r1.floor,\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.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "List all clients who have an active status." }, { "role": "assistant", "content": "SELECT first_name, last_name FROM legal_services.clients WHERE status = 'active';" }, { "role": "user", "content": "Can you include their phone numbers and the date they 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "Find all documents that are larger than 5MB. Show the document ID, claim ID, file name, and file size in bytes." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name, file_size_bytes\nFROM insurance.claim_documents\nWHERE file_size_bytes > 5...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "List each user_id and the date of their latest log." }, { "role": "assistant", "content": "SELECT user_id, MAX(logged_at) AS latest_log\nFROM trading_platform.logs\nGROUP BY user_id;" }, { "role": "user", "content": "Please also show the total number of ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.utxos ( utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO transaction...
[ { "role": "user", "content": "Which customers have policies that expired in the last month? Please show the customer ID, policy number, and expiration date." }, { "role": "assistant", "content": "SELECT c.customer_id, p.policy_number, p.end_date\nFROM insurance.customers c\nJOIN insurance.polici...
You are an SQL statement expert. Given the table 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": "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": "Find the total number of distinct manufacturers listed in the medications table." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT manufacturer) FROM healthcare.medications;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,...
[ { "role": "user", "content": "List all guests who have written at least two reviews, including their full names and the total number of reviews they wrote." }, { "role": "assistant", "content": "SELECT g.guest_id, g.first_name, g.last_name, COUNT(rw.review_id) AS review_count\nFROM hospitality_t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "What is the total and average amount of unspent UTXOs per address?" }, { "role": "assistant", "content": "SELECT\n address,\n COUNT(*) AS utxo_count,\n SUM(amount) AS total_unspent_amount,\n AVG(amount) AS average_unspent_amount\nFROM trading_platform.utxos\nWHE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "For each player, show their username, country_code, registration_date, and the username of the player who registered immediately before them in the same country." }, { "role": "assistant", "content": "SELECT p1.username AS player,\n p1.country_code,\n p1...
You are an SQL statement expert. Given the table 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(), -- unique identifier for the player ...
[ { "role": "user", "content": "List all ERC20 tokens where the price is between $1 and $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...
You are an SQL statement expert. Given the table 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 all trips that were completed with a passenger count greater than 15, including their route and vehicle details." }, { "role": "assistant", "content": "SELECT t.trip_id, t.route_id, t.vehicle_id, t.driver_id, t.scheduled_departure, t.actual_departure, t.sche...
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti...
[ { "role": "user", "content": "For properties located in the city 'Los Angeles', list all rooms that are on floor 3. Include the property name and room number." }, { "role": "assistant", "content": "SELECT p.property_name, r.room_number FROM hospitality_technology.properties p JOIN hospitality_te...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "List each comment_id and the number of likes it has received, but only include comments with at least 5 likes, ordered by like_count ascending." }, { "role": "assistant", "content": "SELECT l.comment_id, COUNT(*) AS like_count\nFROM social_media.likes l\nWHERE l.com...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ...
[ { "role": "user", "content": "How many policies are there for each status, and what is the average premium amount for policies in each status?" }, { "role": "assistant", "content": "SELECT status, COUNT(policy_id), AVG(premium_amount) FROM insurance.policies GROUP BY status ORDER BY COUNT(policy...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ...
[ { "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": "Show me the average difficulty for blocks that have a previous block versus those that don't have a previous block." }, { "role": "assistant", "content": "SELECT CASE WHEN previous_block_id IS NULL THEN 'No Previous Block' ELSE 'Has Previous Block' END AS block_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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text...
[ { "role": "user", "content": "特定のプラットフォームID 'plat_123' に関連するメンテナンス記録を取得するのを手伝っていただけますか?また、記録のステータスも含めてください。" }, { "role": "assistant", "content": "SMEMBERS platform:plat_123:maintenance\nHGETALL maintenance_record:<record_id>" }, { "role": "user", "content": "ステータスが 'Completed' の記録だけ...
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 // Use Hashes for ticket details. Key format: ticket:<ticket_id> // HSET ticket:tkt_1a2b ticket_i...
[ { "role": "user", "content": "List all users whose password hash contains the substring 'abc'." }, { "role": "assistant", "content": "SELECT user_id, username, password_hash FROM blockchain.users WHERE password_hash LIKE '%abc%';" }, { "role": "user", "content": "Also include their 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 blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text ) CREATE TABLE blockchain.users ( ...
[ { "role": "user", "content": "Show me all insurance plans that have more than 5 patients enrolled as their primary insurance, along with the provider name and count of patients, sorted by patient count in descending order." }, { "role": "assistant", "content": "SELECT ip.insurance_provider, ip.p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "List all posts that have never received a comment. Return post_id and user_id." }, { "role": "assistant", "content": "SELECT p.post_id, p.user_id FROM social_media.posts p WHERE NOT EXISTS (SELECT 1 FROM social_media.comments c WHERE c.post_id = p.post_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": "Find all pairs of users who signed up on the same day. Return both usernames and the signup date." }, { "role": "assistant", "content": "SELECT u1.username AS user1, u2.username AS user2, DATE(u1.created_at) AS signup_date\nFROM social_media.users u1\nJOIN social_me...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "List each contract along with the deployer address, and status for contracts deployed on network_id 'mainnet'." }, { "role": "assistant", "content": "SELECT contract_id, address, deployer_address, status FROM web3.contracts WHERE network_id = 'mainnet';" } ]
You are an SQL statement expert. Given the table 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": "List all insurance plans that will expire within the next 30 days, showing the patient IDs and subscriber names." }, { "role": "assistant", "content": "SELECT patient_id, subscriber_name, policy_number, expiration_date\nFROM healthcare.patient_insurance\nWHERE expir...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p...
[ { "role": "user", "content": "List all tokens with a 24-hour trading volume over $1 million and a positive price change percentage in the last 24 hours." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, volume_24h, price_change_percentage_24h FROM token_dexpool_info WHERE v...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "Show me all smart contracts created by addresses that have sent more than 100 transactions, along with the contract creation timestamp." }, { "role": "assistant", "content": "SELECT sc.contract_id, sc.timestamp FROM blockchain.smart_contracts sc JOIN (SELECT sender_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri...