conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Show the application ID, payment amount, and payment method for all payments that have a status of 'Completed' and are related to services in the 'Licensing' category." }, { "role": "assistant", "content": "SELECT p.application_id, p.amount, p.payment_method\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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "Show me pairs of trip IDs that used the same vehicle." }, { "role": "assistant", "content": "SELECT\n t1.trip_id AS trip1_id,\n t2.trip_id AS trip2_id\nFROM transportation.trips AS t1\nJOIN transportation.trips AS t2\n ON t1.vehicle_id = t2.vehicle_id\n AND t1.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.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var...
[ { "role": "user", "content": "Show prescriptions with their corresponding chief complaint from the medical record. Return prescription_id, record_id, and chief_complaint." }, { "role": "assistant", "content": "SELECT p.prescription_id, p.record_id, mr.chief_complaint\nFROM healthcare.prescriptio...
You are an SQL statement expert. Given the table 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 patients who have scheduled appointments with doctors specializing in Cardiology, along with their appointment times and the doctors' full names." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, d...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "I want to find all appointments from the past year for patients diagnosed with 'diabetes', including appointment time, patient full name, and doctor full name." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.appointment_time, CONCAT(p.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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me the number of direct replies each top-level comment has on post 'P200'." }, { "role": "assistant", "content": "SELECT c.comment_id, COUNT(r.comment_id) AS reply_count FROM comments AS c LEFT JOIN comments AS r ON r.parent_comment_id = c.comment_id WHERE c.po...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "List all tokens with their contract addresses and total supply, sorted by total supply in descending order." }, { "role": "assistant", "content": "SELECT token_name, contract_address, total_supply FROM web3.tokens ORDER BY total_supply DESC;" }, { "role": "u...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "Provide the insurance_provider along with pairs of plan IDs and plan names for providers that offer multiple plans. Join the table to itself to find providers with at least two plans." }, { "role": "assistant", "content": "SELECT p1.insurance_provider,\n p1.pl...
You are an SQL statement expert. Given the table 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 all public review comments along with the full name of the guest who submitted the review." }, { "role": "assistant", "content": "SELECT T1.review_id, T2.first_name, T2.last_name, T1.comment FROM hospitality_technology.reviews AS T1 JOIN 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.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Show me all notifications that are related to posts created by users who have a verified profile. Include the notification type, the recipient username, and the post ID." }, { "role": "assistant", "content": "SELECT\n n.notification_type,\n u_recipient.username 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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "List all claim documents uploaded by agent 'AG789', showing their document types and upload dates." }, { "role": "assistant", "content": "SELECT document_id, document_type, uploaded_at FROM insurance.claim_documents WHERE uploaded_by = 'AG789';" }, { "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 insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ...
[ { "role": "user", "content": "Show the count of posts for each distinct media type." }, { "role": "assistant", "content": "SELECT media_type, COUNT(*) FROM social_media.posts GROUP BY media_type;" }, { "role": "user", "content": "Only include posts created after June 1, 2024." }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u...
[ { "role": "user", "content": "Show each player’s username, the number of achievements they have unlocked, and the total quantity of items they currently have in their inventory." }, { "role": "assistant", "content": "SELECT p.username,\n COUNT(DISTINCT pa.achievement_id) AS achievements_co...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "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": "I need a report showing each case's first and last time entry dates, and the duration between them." }, { "role": "assistant", "content": "SELECT f.case_id,\n f.first_date,\n l.last_date,\n l.last_date - f.first_date AS duration\nFROM (\n 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 legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billi...
[ { "role": "user", "content": "Show each patient's policy number, the associated insurance plan ID, and any medications they have been prescribed, including the medication ID and prescription date." }, { "role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.plan_id, pr.medic...
You are an SQL statement expert. Given the table 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, record_id character varying(64) NOT NULL, patient_i...
[ { "role": "user", "content": "I want to see each active agent and the total premium_amount of the policies they sold in 2024." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name, a.last_name, SUM(p.premium_amount) AS total_premium\nFROM insurance.agents a\nJOIN insurance.polic...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "Count the number of appointments for each status." }, { "role": "assistant", "content": "SELECT status, count(*) FROM government_services.appointments GROUP BY status;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.appointments ( appointment_id character varying(64) NOT NULL, citizen_id character varying(64) NOT ...
[ { "role": "user", "content": "For each manager, count how many agents they manage. Show manager_id and agent_count." }, { "role": "assistant", "content": "SELECT manager_id,\n COUNT(*) AS agent_count\nFROM insurance.agents\nGROUP BY manager_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.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "Which citizens have submitted applications for services offered by agencies established before 2020? Please show the citizen's first name, last name, and the agency's name." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.agency_name\nFROM ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Show me the total number of bookings and total fare collected per trip. Only include trips that have collected more than 500 in total fare." }, { "role": "assistant", "content": "SELECT trip_id, COUNT(*) AS booking_count, SUM(fare) AS total_fare\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.bookings ( booking_id character varying(64) NOT NULL, -- unique identifier for the booking pass...
[ { "role": "user", "content": "For each snapshot_time in cex_token_balance, calculate the total usd_value across all exchanges and order by snapshot_time ascending." }, { "role": "assistant", "content": "SELECT snapshot_time,\n SUM(usd_value) AS total_usd_value\nFROM cex_token_balance\nGROU...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "Find pairs of developers located in the same country but founded in different years." }, { "role": "assistant", "content": "SELECT d1.name AS developer1, d2.name AS developer2, d1.country, d1.founded_year, d2.founded_year\nFROM gaming_technology.developers d1\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 gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_...
[ { "role": "user", "content": "Show me all patients who have both primary and non-primary insurance plans from the same provider, including their policy numbers and expiration dates." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, pi1.policy_number AS primary_policy, pi1....
You are an SQL statement expert. Given the table 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 a count of drivers per status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS driver_count\nFROM transportation.drivers\nGROUP BY status;" }, { "role": "user", "content": "Can you also list the earliest hire date for each status?"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "Show me all users and the posts they have created, including the user's username and the post content." }, { "role": "assistant", "content": "SELECT u.username, p.post_id, p.content\nFROM social_media.users u\nJOIN social_media.posts p ON u.user_id = p.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 text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Find pairs of items from the same game, where one item is of type 'Weapon' and the other is of type 'Consumable'. List the game ID, the name of the weapon, and the name of the consumable." }, { "role": "assistant", "content": "SELECT i1.game_id, i1.item_name AS weap...
You are an SQL statement expert. Given the table 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.in_game_items ( item_id.uuid, game_id.uuid, item_name.text, item_type.text, description.text, rarity....
[ { "role": "user", "content": "List all premium payments with a due date in March 2024." }, { "role": "assistant", "content": "SELECT * FROM insurance.premium_payments WHERE due_date >= '2024-03-01' AND due_date <= '2024-03-31';" } ]
You are an SQL statement expert. Given the table 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 all passengers who have booked a trip to a city named 'Chicago'. Show their first name, last name, email, and the booking ID." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, p.email, b.booking_id\nFROM transportation.bookings b\nJOIN tr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id character varying(64) NOT NULL, -- unique identifier for the location n...
[ { "role": "user", "content": "List all service orders for spa services in the last month, including the guest ID and total price." }, { "role": "assistant", "content": "SELECT order_id, guest_id, total_price FROM hospitality_technology.service_orders WHERE service_id LIKE 'SPA%' AND order_timest...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Show me the top 5 smart money addresses by profit on the Ethereum chain, along with their most profitable token and ROI." }, { "role": "assistant", "content": "SELECT address, most_profit_token, roi FROM smart_money_profit WHERE chain = 'Ethereum' ORDER BY profit DE...
You are an SQL statement expert. Given the table 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 character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres...
[ { "role": "user", "content": "Which users have disabled both email and push notifications? Please provide their user IDs and whether their profiles are private." }, { "role": "assistant", "content": "SELECT user_id, private_profile FROM social_media.user_settings WHERE email_notifications_enable...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.user_settings ( setting_id text PRIMARY KEY, user_id text, theme text, email_notifications_enabled bool, p...
[ { "role": "user", "content": "Show me all servers that have the same current_players value as another server in a different region. List both server names, their regions, and the current_players value." }, { "role": "assistant", "content": "SELECT s1.server_name AS server1, s1.region AS region1,...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,...
[ { "role": "user", "content": "List events from contract '0xContractA...' that occurred between '2023-01-01' and '2023-01-31'. Show the event ID, event name, and emitted timestamp." }, { "role": "assistant", "content": "SELECT event_id, event_name, emitted_at FROM web3.events WHERE contract_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.events ( event_id character varying(64) NOT NULL, -- unique identifier for the event contract_id characte...
[ { "role": "user", "content": "Which user has the earliest created wallet? Show the user_id, wallet_id, address, and the creation timestamp." }, { "role": "assistant", "content": "SELECT user_id, wallet_id, address, created_at\nFROM web3.wallets\nORDER BY created_at ASC\nLIMIT 1;" }, { "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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "For each user, what is the average time difference in days between their wallet creations? Return user_id and avg_diff_days." }, { "role": "assistant", "content": "WITH diffs AS (\n SELECT\n user_id,\n EXTRACT(EPOCH FROM (created_at - LAG(created_at) OVER (PA...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "List all vehicles along with their make, model, and license plate, that have not had any maintenance service since '2023-01-01'." }, { "role": "assistant", "content": "SELECT v.vehicle_id, v.make, v.model, v.license_plate FROM transportation.vehicles AS v WHERE 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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "What is the total amount invoiced per status?" }, { "role": "assistant", "content": "SELECT status,\n SUM(total_amount) AS total_invoiced\nFROM legal_services.invoices\nGROUP BY status;" }, { "role": "user", "content": "Only include statuses 'Paid'...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice invo...
[ { "role": "user", "content": "Can you retrieve the document_id, file_name, file_size_bytes, uploaded_at, and the full name of the agent (first and last name concatenated) for all documents uploaded in 2024 by active agents licensed in CA?" }, { "role": "assistant", "content": "SELECT cd.document...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.agents ( agent_id text, first_name text, last_name text, agency_name text, license_number text, license_state...
[ { "role": "user", "content": "List all medications with a description that includes the word 'antibiotic'." }, { "role": "assistant", "content": "SELECT * FROM healthcare.medications WHERE description ILIKE '%antibiotic%';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd...
[ { "role": "user", "content": "Return the customer_id, full name, policy_id, and start date of all policies sold by agents whose commission_rate is less than 0.08. Please also include the product_name of the related insurance product." }, { "role": "assistant", "content": "SELECT p.customer_id, 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 insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin...
[ { "role": "user", "content": "List all doctors who were created in the year 2022. Show their doctor ID, first name, and last name." }, { "role": "assistant", "content": "SELECT doctor_id, first_name, last_name FROM healthcare.doctors WHERE EXTRACT(YEAR FROM created_at) = 2022" }, { "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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "List all tokens on the 'Ethereum' chain with DEX 24h volume over 1000000. Show token_symbol, price, and volume_24h." }, { "role": "assistant", "content": "SELECT token_symbol, price, volume_24h\nFROM token_dexpool_info\nWHERE chain = 'Ethereum' AND volume_24h > 1000...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "List all trips where the actual origin location is different from the scheduled origin location or the actual destination location is different from the scheduled destination location. Show trip ID, scheduled origin/destination location IDs, and actual origin/destination locati...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Show me all premium payments made in Q1 2023, along with their payment methods and amounts, sorted by payment date." }, { "role": "assistant", "content": "SELECT payment_method, amount_paid, payment_date FROM insurance.premium_payments WHERE payment_date BETWEEN '20...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo...
[ { "role": "user", "content": "Show me the post ID, user ID, and creation time for all posts created in April 2024." }, { "role": "assistant", "content": "SELECT post_id, user_id, created_at FROM social_media.posts WHERE created_at >= '2024-04-01' AND created_at < '2024-05-01';" }, { "rol...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u...
[ { "role": "user", "content": "For each user, show their user ID and the count of unique wallet addresses they own." }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT address) FROM wallets GROUP BY 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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
[ { "role": "user", "content": "List the ticker and creator for all tokens recorded in the `token_info_avalanche` table." }, { "role": "assistant", "content": "SELECT tick, creator FROM token_info_avalanche" }, { "role": "user", "content": "Now, for these tokens, show their latest pric...
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 erc20_balances_historical ( block_number.bigint, contract_address.text, wallet_addre...
[ { "role": "user", "content": "Show me all NFT collections on the 'Ethereum' blockchain, listing their name, contract address, and ERC type." }, { "role": "assistant", "content": "SELECT name, contract_address, erc_type FROM nft_collections WHERE blockchain = 'Ethereum'" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc20_balances ( block_number bigint, contract_address text, wallet_address text, amount text, pk text ) CREATE TABLE n...
[ { "role": "user", "content": "List all address IDs with a balance under 50, along with the count of transactions they have received." }, { "role": "assistant", "content": "SELECT a.address_id, a.balance, COUNT(t.transaction_id) AS received_count\nFROM blockchain.addresses a\nLEFT JOIN blockchain...
You are an SQL statement expert. Given the table 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...
[ { "role": "user", "content": "Show me all nodes that were last seen after January 1, 2023, along with their IP addresses and ports." }, { "role": "assistant", "content": "SELECT node_id, ip_address, port FROM blockchain.nodes WHERE last_seen > '2023-01-01 00:00:00';" }, { "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.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
[ { "role": "user", "content": "Find all events where the data field contains 'amount' and show the event name, contract ID, and transaction ID, sorted by emitted timestamp." }, { "role": "assistant", "content": "SELECT event_name, contract_id, transaction_id FROM web3.events WHERE data LIKE '%amo...
You are an SQL statement expert. Given the table 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": "For each trip, show the trip_id, vehicle's license plate, total fuel quantity, and number of fueling events." }, { "role": "assistant", "content": "SELECT t.trip_id, v.license_plate, SUM(f.quantity) AS total_fuel, COUNT(f.fuel_log_id) AS fueling_events FROM transpor...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Show me all prescriptions, including the prescription ID, medication ID, prescription date, and the prescribing doctor's ID, for patients who have received more than 2 prescriptions." }, { "role": "assistant", "content": "SELECT prescription_id, medication_id, presc...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio...
[ { "role": "user", "content": "List guests currently checked into rooms on the 3rd floor, including their full name, room number, and check-in date." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T3.room_number, T2.check_in_date FROM hospitality_technology.guests AS T1...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "Find all events where the data field contains 'amount' and show the event name, contract ID, and transaction ID, along with the log index, sorted by log index in ascending order." }, { "role": "assistant", "content": "SELECT event_name, contract_id, transaction_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.events ( event_id text PRIMARY KEY, contract_id text, event_name text, data text, emitted_at timestamp, transactio...
[ { "role": "user", "content": "Which employees have been assigned to applications for services with a standard fee greater than 200? Show the employee's full name, job title, application ID, and the service name." }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.last_name 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 character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "List all locations of type 'depot' in the United States, showing their name, state, and city." }, { "role": "assistant", "content": "SELECT name, state_province, city FROM transportation.locations WHERE country = 'United States' AND type = 'depot';" }, { "ro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, ...
[ { "role": "user", "content": "Could you provide the total number of game sessions and the number of distinct players for each game genre? Display the genre, session count, and player count." }, { "role": "assistant", "content": "SELECT g.genre, COUNT(gs.session_id) AS session_count, COUNT(DISTIN...
You are an SQL statement expert. Given the table 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": "Show the email address and the creation date for every user, ordered by their username alphabetically." }, { "role": "assistant", "content": "SELECT email, created_at FROM trading_platform.users ORDER BY username ASC;" } ]
You are an SQL statement expert. Given the table 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 )
[ { "role": "user", "content": "Show me all ERC-1155 NFT contracts on Ethereum with their collection name and the number of unique holders for each contract." }, { "role": "assistant", "content": "SELECT nc.contract_address, nc.name, COUNT(DISTINCT nh.wallet_address) AS unique_holders\nFROM nft_ho...
You are an SQL statement expert. Given the table 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": "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": "List all trips that are currently 'Scheduled'." }, { "role": "assistant", "content": "SELECT * FROM transportation.trips WHERE status = 'Scheduled'" }, { "role": "user", "content": "For these scheduled trips, can you also include the route number and est...
You are an SQL statement expert. Given the table 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": "List the first and last names of citizens who have submitted documents with a verification status of 'Rejected', along with the document type and application reference number." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, d.document_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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "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": "Show each customer's checking and savings account numbers for customers who have both types." }, { "role": "assistant", "content": "SELECT a.customer_id,\n a.account_number AS checking_account,\n b.account_number AS savings_account\nFROM financial_servic...
You are an SQL statement expert. Given the table 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": "List all insurance products along with their product type and creation date." }, { "role": "assistant", "content": "SELECT product_name, product_type, created_at\nFROM insurance.insurance_products;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "Find all users and the total value of transactions they have received, showing user_id, username, and total_received_value." }, { "role": "assistant", "content": "SELECT u.user_id,\n u.username,\n COALESCE(SUM(t.value), 0) AS total_received_value\nFROM w...
You are an SQL statement expert. Given the table 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": "Calculate the total fuel quantity and total cost consumed for each trip where passenger_count > 50. List trip_id, total_quantity, and total_cost." }, { "role": "assistant", "content": "SELECT f.trip_id,\n SUM(f.quantity) AS total_quantity,\n SUM(f.total_...
You are an SQL statement expert. Given the table 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": "Show me all ERC1155 NFTs on Ethereum with their contract address, token_id, and the total amount held by all current holders." }, { "role": "assistant", "content": "SELECT nh.contract_address, nh.token_id, SUM(CAST(nh.amount AS NUMERIC)) AS total_amount\nFROM nft_ho...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "For each player and server pair, show the total number of game sessions they've had together and the sum of scores, ordered by total sessions descending." }, { "role": "assistant", "content": "SELECT player_id, server_id, COUNT(*) AS total_sessions, SUM(score) AS to...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time...
[ { "role": "user", "content": "Count the number of lawyers in each firm. Show the firm ID and the count." }, { "role": "assistant", "content": "SELECT firm_id, COUNT(*) AS lawyer_count FROM legal_services.lawyers GROUP BY firm_id ORDER BY firm_id;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "role": "user", "content": "List all primary insurance policies that will expire within the next 30 days. Return patient_insurance_id, patient_id, policy_number, and expiration_date." }, { "role": "assistant", "content": "SELECT patient_insurance_id,\n patient_id,\n policy_number,\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam...
[ { "role": "user", "content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and the count of events emitted by each contract, sorted by event count in descending order." }, { "role": "assistant", "content": "SELECT c.address, c.deployer_address, COU...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the contract address cha...
[ { "role": "user", "content": "Find all narratives that have a positive price change percentage over the last hour, 24 hours, and 7 days." }, { "role": "assistant", "content": "SELECT narrative FROM narrative_info WHERE price_change_percentage_1h > 0 AND price_change_percentage_24h > 0 AND price_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume...
[ { "role": "user", "content": "List pairs of customers who live in the same city. Return both customer IDs, their full names, and the city." }, { "role": "assistant", "content": "SELECT c1.customer_id AS customer1_id, c1.first_name || ' ' || c1.last_name AS customer1_name, c2.customer_id AS custo...
You are an SQL statement expert. Given the table 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": "For applications approved in the past month, list the application ID, reference number, citizen's first and last name, and the number of related notifications sent." }, { "role": "assistant", "content": "SELECT a.application_id, a.reference_number, c.first_name, c.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 government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Give me a list of employees (first and last name) along with the count of appointments they have scheduled." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, COUNT(a.appointment_id) AS appointment_count\nFROM government_services.employees e\nL...
You are an SQL statement expert. Given the table 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": "Retrieve the guest_id, first_name, last_name, and loyalty_member_id for all guests who have communication_consent enabled." }, { "role": "assistant", "content": "SELECT guest_id, first_name, last_name, loyalty_member_id\nFROM hospitality_technology.guests\nWHERE 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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- unique identifier for the room prope...
[ { "role": "user", "content": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their token symbol and narrative." }, { "role": "assistant", "content": "SELECT token_symbol, narrative, usd_value FROM smart_money_token_inflow WHERE type = 1 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 project_fundraising_record (", "id character varying(32) NOT NULL, -- fundraising record id", "project_id ch...
[ { "role": "user", "content": "Get the count of insurance policies for each patient. Return patient_id and policy_count." }, { "role": "assistant", "content": "SELECT patient_id, COUNT(*) AS policy_count FROM healthcare.patient_insurance GROUP BY patient_id;" }, { "role": "user", "con...
You are an SQL statement expert. Given the table 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": "Show me the total number of reservations and the sum of total_amount for each booking_source." }, { "role": "assistant", "content": "SELECT r.booking_source,\n COUNT(*) AS reservation_count,\n SUM(r.total_amount) AS total_revenue\nFROM hospitality_techno...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Show all beneficiaries assigned to policy ID 'POL67890', with their first and last names, relationship, and the date they were added." }, { "role": "assistant", "content": "SELECT first_name, last_name, relationship, added_at\nFROM insurance.policy_beneficiaries\nWH...
You are an SQL statement expert. Given the table 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": "Could you list the player_id of users who have unlocked both achievement '11111111-1111-1111-1111-111111111111' and '22222222-2222-2222-2222-222222222222'?" }, { "role": "assistant", "content": "SELECT pa1.player_id\nFROM gaming_technology.player_achievements pa1\nJ...
You are an SQL statement expert. Given the table 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": "I want to find all medical records, the record ID and date, where the blood pressure in vitals starts with '120/'. Could you also show the patient ID?" }, { "role": "assistant", "content": "SELECT record_id, record_date, patient_id, vitals->>'blood_pressure' AS bloo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "Show me all insurance plans that have more than 3 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, 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.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "List all pairs of fuel log entries for the same vehicle that occurred more than 7 days apart, showing vehicle_id, first_log_id, second_log_id, and the time difference in days." }, { "role": "assistant", "content": "SELECT f1.vehicle_id,\n f1.fuel_log_id AS fir...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu...
[ { "role": "user", "content": "Show me all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and belong to the 'Technology' sector, along with their last_updated timestamp." }, { "role": "assistant", "content": "SELECT security_id, ticker_symbol, securi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.securities ( security_id character varying(64) NOT NULL, ticker_symbol character varying(20) NOT NUL...
[ { "role": "user", "content": "Show me the top 5 NFT collections with the highest token count on Ethereum, along with their names, symbols, and floor prices." }, { "role": "assistant", "content": "SELECT n.name, n.symbol, n.floor_price, n.token_count FROM nft_collections n WHERE n.blockchain = '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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "Could you list the route number and description for any routes that have a fuel log entry associated with their origin or destination location?" }, { "role": "assistant", "content": "SELECT DISTINCT T1.route_number, T1.description FROM transportation.routes AS T1 JO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, -- unique identifier for the driver employe...
[ { "role": "user", "content": "List all premium payments with status 'overdue'. Show payment_id, policy_id, customer_id, amount_paid, ordered by due_date ascending." }, { "role": "assistant", "content": "SELECT payment_id,\n policy_id,\n customer_id,\n amount_paid\nFROM insuranc...
You are an SQL statement expert. Given the table 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 all claim IDs, policy IDs, and incident dates for claims reported after February 1st, 2024." }, { "role": "assistant", "content": "SELECT claim_id, policy_id, incident_date\nFROM insurance.claims\nWHERE reported_date > '2024-02-01';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "List each claim with its policy number and the selling agent's first and last name." }, { "role": "assistant", "content": "SELECT c.claim_id, p.policy_number, a.first_name, a.last_name\nFROM insurance.claims c\nJOIN insurance.policies p ON c.policy_id = p.policy_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.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "What is the average age of customers created in the last year?" }, { "role": "assistant", "content": "SELECT AVG(DATE_PART('year', CURRENT_DATE) - DATE_PART('year', date_of_birth)) FROM financial_services.customers WHERE created_at >= CURRENT_DATE - INTERVAL '1 year...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "Show all tokens on the Ethereum chain in token_dexpool_info that had a price increase in the last 6 hours, along with their 24h trading volume and smart money ROI." }, { "role": "assistant", "content": "SELECT td.token_symbol,\n td.price_change_percentage_6h,\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "Show me wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address." }, { "role": "assistant", "content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders nh JOIN token_metas tm ON nh.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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "List all medical records, showing the record ID, record date, and the full name of the doctor who created the record. Include the patient ID as well." }, { "role": "assistant", "content": "SELECT mr.record_id, mr.record_date, mr.patient_id, d.first_name, d.last_name...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "Find all combinations of insurance plans and medications where the plan type is 'HMO' and the medication's description mentions 'cream'. List the plan ID, plan name, medication ID, and medication name." }, { "role": "assistant", "content": "SELECT p.plan_id, p.plan_...
You are an SQL statement expert. Given the table 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": "Calculate the average star rating for each property type." }, { "role": "assistant", "content": "SELECT property_type, AVG(star_rating) AS average_star_rating FROM hospitality_technology.properties GROUP BY property_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.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Please provide each follow relationship, including the follower's username, the followed user's username, and the follow creation timestamp." }, { "role": "assistant", "content": "SELECT\n u1.username AS follower_username,\n u2.username AS following_username,\n f...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...