conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "What is the total quantity and total cost of fuel consumed for each fuel type recorded in the fuel logs?" }, { "role": "assistant", "content": "SELECT fuel_type, SUM(quantity) AS total_quantity, SUM(total_cost) AS total_cost FROM transportation.fuel_logs GROUP BY fu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "For each patient, show their full name and the count of insurance plans they are enrolled in, as well as their earliest policy effective date." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, COUNT(pi.plan_id) AS plan_count, MIN(pi.effective_...
You are an SQL statement expert. Given the table 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 patient insurance entries where the subscriber name is different from the patient's last name. Include patient ID, subscriber name, and patient last name." }, { "role": "assistant", "content": "SELECT T1.patient_id, T1.subscriber_name, T2.last_name FROM hea...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "Get me a list of upcoming appointments with appointment_id, client full name, case number, and start_time for appointments with status 'scheduled'." }, { "role": "assistant", "content": "SELECT a.appointment_id,\n CONCAT(cl.first_name, ' ', cl.last_name) 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "For each country code, what is the earliest registration date of a player?" }, { "role": "assistant", "content": "SELECT country_code, MIN(registration_date) AS earliest_reg_date FROM gaming_technology.players GROUP BY country_code;" }, { "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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Show me all rooms that are currently available (status = 'available') and have a non-smoking policy, along with their room type details including base rate and max occupancy." }, { "role": "assistant", "content": "SELECT r.room_id, r.room_number, r.floor, rt.type_na...
You are an SQL statement expert. Given the table 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 the number of employees hired in each department per year." }, { "role": "assistant", "content": "SELECT\n department,\n EXTRACT(YEAR FROM hire_date) AS hire_year,\n COUNT(employee_id) AS employee_count\nFROM financial_services.employees\nWHERE\n hire_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 financial_services.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "Show me all medical records where the treatment_plan includes 'physical therapy' along with the patient_id and record_date, sorted by most recent first." }, { "role": "assistant", "content": "SELECT patient_id, record_date, treatment_plan FROM healthcare.medical_rec...
You are an SQL statement expert. Given the table 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": "For each developer, show their name and the total number of in-game items in all games they've developed." }, { "role": "assistant", "content": "SELECT d.name AS developer_name,\n COUNT(i.item_id) AS total_items\nFROM gaming_technology.developers d\nJOIN gamin...
You are an SQL statement expert. Given the table 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": "How many notifications have been sent for comments in total?" }, { "role": "assistant", "content": "SELECT COUNT(*)\nFROM social_media.notifications\nWHERE target_entity_type = 'comment';" } ]
You are an SQL statement expert. Given the table 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": "Could you show me a list of posts, including their content, and the total number of comments and likes each post has received?" }, { "role": "assistant", "content": "SELECT\n p.post_id,\n p.content,\n COUNT(DISTINCT c.comment_id) AS comment_count,\n 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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "How many 'ApprovalForAll' events are recorded for each ERC1155 contract address in the `erc1155_approval_for_all` table?" }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_addres...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "For each type of entity a notification can be related to, how many notifications have been successfully sent?" }, { "role": "assistant", "content": "SELECT related_entity_type, COUNT(*) AS sent_notification_count FROM government_services.notifications WHERE 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.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego...
[ { "role": "user", "content": "Show the number of reservations and the sum total_amount for each property." }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, COUNT(r.reservation_id) AS reservation_count, SUM(r.total_amount) AS total_revenue \nFROM hospitality_technology...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Which pairs of routes have the same distance in kilometers but different estimated durations? Show their route numbers, distances and both estimated durations." }, { "role": "assistant", "content": "SELECT r1.route_number AS route_number_1, r2.route_number AS route_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati...
[ { "role": "user", "content": "Which hashtags appear on the most posts? Return hashtag_id, tag_name, and the number of posts each hashtag is used in, sorted descending, limited to the top 3." }, { "role": "assistant", "content": "SELECT\n h.hashtag_id,\n h.tag_name,\n COUNT(ph.post_id) AS post...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t...
[ { "role": "user", "content": "Can you give me the count of players grouped by their status?" }, { "role": "assistant", "content": "SELECT status,\n COUNT(*) AS player_count\nFROM gaming_technology.players\nGROUP BY status;" }, { "role": "user", "content": "Actually, include the...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "List pairs of smoking and non-smoking rooms on the same floor for each property, showing the property_id, floor, smoking room_number, and non_smoking room_number." }, { "role": "assistant", "content": "SELECT r1.property_id,\n r1.floor,\n r1.room_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 hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "Show me all patients who have a primary insurance plan from 'Blue Cross', along with their insurance policy numbers and the plan types." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, ip.plan_type FROM healthc...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List the first and last names of all lawyers who have worked on time entries for cases associated with clients from the company 'Innovatech Ltd'." }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name, T1.last_name FROM legal_services.lawyers AS T1 INN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List all trades that occurred on July 10, 2024, showing the trade ID, asset symbol, quantity, and trade price." }, { "role": "assistant", "content": "SELECT t.trade_id, a.symbol AS asset_symbol, t.quantity, t.price\nFROM trading_platform.trades t\nJOIN trading_platf...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id ch...
[ { "role": "user", "content": "Show me the top 5 tokens by USD value held on the Binance Smart Chain, along with their average price and total balance." }, { "role": "assistant", "content": "SELECT token_symbol, AVG(price) as average_price, SUM(balance) as total_balance, SUM(usd_value) as total_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 cex_token_balance ( snapshot_time text, chain text, address text, exchange text, token_address text, token_symbol text,...
[ { "role": "user", "content": "Show me the full name of every lawyer, their specialization, and the number of cases they are the lead lawyer for." }, { "role": "assistant", "content": "SELECT CONCAT(l.first_name, ' ', l.last_name) AS lawyer_name, l.specialization, COUNT(c.case_id) AS lead_case_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 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 active staff members who are managers, along with their hire dates and email addresses." }, { "role": "assistant", "content": "SELECT staff_id, first_name, last_name, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true AND positio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city....
[ { "role": "user", "content": "Retrieve the first and last names of all doctors who specialize in Cardiology." }, { "role": "assistant", "content": "SELECT first_name, last_name\nFROM healthcare.doctors\nWHERE specialty = 'Cardiology';" } ]
You are an SQL statement expert. Given the table 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": "Which wallets currently have the largest ERC20 balances? Show the wallet address, contract address, and amount, sorted by amount descending." }, { "role": "assistant", "content": "SELECT wallet_address, contract_address, CAST(amount AS DECIMAL) as amount FROM erc20_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "Show me the email addresses and usernames of users who have sent messages in group chats." }, { "role": "assistant", "content": "SELECT DISTINCT u.email, u.username\nFROM social_media.messages m\nJOIN social_media.conversations c ON m.conversation_id = c.conversatio...
You are an SQL statement expert. Given the table 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": "Find the total number of unique document types stored in the claim_documents table." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT document_type) FROM insurance.claim_documents;" } ]
You are an SQL statement expert. Given the table 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": "What is the average interest rate for personal loans (loan_type = 'Personal') with a term of 60 months?" }, { "role": "assistant", "content": "SELECT AVG(interest_rate) FROM financial_services.loans WHERE loan_type = 'Personal' AND term_months = 60;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b...
[ { "role": "user", "content": "Count the number of medications provided by the manufacturer 'Novartis'." }, { "role": "assistant", "content": "SELECT count(*) FROM healthcare.medications WHERE manufacturer = 'Novartis'" } ]
You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ...
[ { "role": "user", "content": "List all maintenance logs for vehicles that had 'Oil Change' service in the last 3 months, showing vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_typ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, -- unique identifier for the route route_numb...
[ { "role": "user", "content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?" }, { "role": "assistant", "content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.develo...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, name text, country text, founded_year int, website text, ...
[ { "role": "user", "content": "List all pairs of games developed by the same developer, returning developer_id, title of the first game, and title of the second game." }, { "role": "assistant", "content": "SELECT g1.developer_id, g1.title AS game1, g2.title AS game2\nFROM gaming_technology.games ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date...
[ { "role": "user", "content": "Show the total number of services offered per department and the average price of those services." }, { "role": "assistant", "content": "SELECT department, COUNT(*) AS service_count, AVG(price) AS avg_price\nFROM hospitality_technology.services\nGROUP BY department;...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu...
[ { "role": "user", "content": "For each server, find the maximum score achieved on that server along with its region and game_id." }, { "role": "assistant", "content": "SELECT s.server_id, s.region, s.game_id, MAX(gs.score) AS max_score FROM gaming_technology.servers s JOIN gaming_technology.game...
You are an SQL statement expert. Given the table 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": "List all trades with their order_id, trade_type, and commission for trades with commission higher than 100." }, { "role": "assistant", "content": "SELECT trade_id, order_id, trade_type, commission FROM financial_services.trades WHERE commission > 100;" }, { ...
You are an SQL statement expert. Given the table 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": "How many reservations does each property have?" }, { "role": "assistant", "content": "SELECT property_id,\n COUNT(*) AS reservation_count\nFROM hospitality_technology.reservations\nGROUP BY property_id;" }, { "role": "user", "content": "Actually, 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 hospitality_technology.reservations ( reservation_id.text, property_id.text, guest_id.text, room_id.text, room_type_id....
[ { "role": "user", "content": "List all wallets that were created during the hour of the day which saw the highest number of wallet creations. Show the wallet ID, user ID, address, and creation timestamp." }, { "role": "assistant", "content": "WITH HourlyCounts AS (\n SELECT EXTRACT(HOUR FROM ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "List all users, showing their user ID, username, and the total number of wallets they have created. Include users who have no wallets." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(w.wallet_id) AS wallet_count FROM trading_platform.users...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "List all trips including the name of the origin location and the name of the destination location." }, { "role": "assistant", "content": "SELECT t.trip_id, origin.name AS origin_location_name, destination.name AS destination_location_name FROM transportation.trips 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.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "I need a report that shows, for each account status and loan type, how many loans there are and the average principal amount." }, { "role": "assistant", "content": "SELECT a.status,\n l.loan_type,\n COUNT(*) AS total_loans,\n AVG(l.principal_amount...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same...
[ { "role": "user", "content": "List all SUI NFT objects with status 'exists', showing the object_id, name, and owner." }, { "role": "assistant", "content": "SELECT object_id, name, owner FROM sui_nfts WHERE status = 'exists';" }, { "role": "user", "content": "Add the collection type 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 erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "List all properties and the count of reservations associated with guests from 'USA'." }, { "role": "assistant", "content": "SELECT T1.property_name, count(T2.reservation_id) FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.reservations AS T2 ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "List all securities that have had at least one market data entry where the closing price was higher than the opening price, including their security name and ticker symbol." }, { "role": "assistant", "content": "SELECT DISTINCT T1.security_name, T1.ticker_symbol FRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id text, account_id text, related_account_id text, transaction_type text,...
[ { "role": "user", "content": "List tokens on the 'Polygon' chain held by CEX addresses. Show token_symbol and total USD value held." }, { "role": "assistant", "content": "SELECT token_symbol, SUM(usd_value) AS total_usd_value\nFROM cex_token_balance\nWHERE chain = 'Polygon'\nGROUP BY token_symbo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "List all clients along with their case_number and case_type for cases that are currently 'Open'." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, c.email, cs.case_number, cs.case_type\nFROM legal_services.clients AS c\nJOIN legal_services.cas...
You are an SQL statement expert. Given the table 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 players who unlocked between 5 and 10 achievements in the year 2023. List their player ID and the count of achievements unlocked in 2023." }, { "role": "assistant", "content": "SELECT player_id, COUNT(*) AS achievement_count_2023 FROM gaming_technology.play...
You are an SQL statement expert. Given the table 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(), -- unique id...
[ { "role": "user", "content": "Show the route number, route type, and the names of the origin and destination locations for all routes." }, { "role": "assistant", "content": "SELECT r.route_number, r.type, l1.name AS origin_name, l2.name AS destination_name\nFROM transportation.routes r\nJOIN tra...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati...
[ { "role": "user", "content": "For each publisher, find pairs of games they have published that belong to different genres. Include publisher_id, the genre and title of both games in each pair." }, { "role": "assistant", "content": "SELECT g1.publisher_id,\n g1.genre AS genre1,\n g1.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 gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game ti...
[ { "role": "user", "content": "List the number of bookings made by each passenger, including passenger_id, first_name, last_name, and booking_count." }, { "role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n COUNT(b.booking_id) AS booking_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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "List all cancelled policies with their cancellation reasons and premium amounts, sorted by cancellation date in descending order." }, { "role": "assistant", "content": "SELECT policy_id, cancellation_reason, premium_amount, cancellation_date FROM insurance.policies ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ...
[ { "role": "user", "content": "List all appointments scheduled for '2024-07-25' with a status of 'Scheduled'." }, { "role": "assistant", "content": "SELECT * FROM legal_services.appointments WHERE DATE(start_time) = '2024-07-25' AND status = 'Scheduled'" } ]
You are an SQL statement expert. Given the table 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": "Can you help me retrieve inspection records for a specific step ID, including the inspection type, result, timestamp, and the associated build ID?" }, { "role": "assistant", "content": "db.inspections.find({ step_id: 'specific_step_id' }, { inspection_type: 1, resul...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id...
[ { "role": "user", "content": "List the document name, type, version, and description for all documents." }, { "role": "assistant", "content": "SELECT document_name, document_type, version, description FROM documents;" }, { "role": "user", "content": "Only include documents where the ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "I need a list of all SUI coins with their object ID, coin type, and balance." }, { "role": "assistant", "content": "SELECT object_id, coin_type, balance FROM sui_coins;" }, { "role": "user", "content": "Only include coins where status is 'exists'." }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ...
[ { "role": "user", "content": "List all item names and quantities a player with username 'DragonRider' owns, and include the game titles for those items." }, { "role": "assistant", "content": "SELECT i.item_name, pi.quantity, g.title AS game_title\nFROM gaming_technology.players p\nJOIN gaming_te...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "List all assets that have metadata entries for both 'category' and 'blockchain_network', along with their corresponding values." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, m1.value AS category, m2.value AS blockchain_network FROM trading_platfo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "List all employees who were hired in the last two years along with their department and status." }, { "role": "assistant", "content": "SELECT employee_id, first_name, last_name, department, status FROM financial_services.employees WHERE hire_date >= (CURRENT_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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "Count the total number of reviews submitted in the year 2022." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM hospitality_technology.reviews WHERE EXTRACT(YEAR FROM review_date) = 2022;" }, { "role": "user", "content": "Now, show the count 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 hospitality_technology.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i...
[ { "role": "user", "content": "List the diagnosis ID, description, and diagnosis date for all non-chronic diagnoses recorded for patient 'pat123'." }, { "role": "assistant", "content": "SELECT diagnosis_id, description, diagnosis_date FROM healthcare.diagnoses WHERE patient_id = 'pat123' AND is_c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty...
[ { "role": "user", "content": "Show all prescriptions made in 2024 for medications prescribed during appointments scheduled at location 'LOC001', including prescription_id, patient_id, medication_id, and appointment_time." }, { "role": "assistant", "content": "SELECT pr.prescription_id, pr.patien...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show each user's username along with their total traded value as buyers and their total traded value as sellers for trades executed in June 2024." }, { "role": "assistant", "content": "SELECT u.username,\n COALESCE(buy_tot.buy_value, 0) AS buyer_value,\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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "List all employees with the job title 'Analyst'. Show their first name, last name, and department." }, { "role": "assistant", "content": "SELECT first_name, last_name, department\nFROM government_services.employees\nWHERE job_title = 'Analyst';" } ]
You are an SQL statement expert. Given the table 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": "List each doctor and the total number of unique patients for appointments that have been completed. Return doctor_id, first_name, last_name, and patient_count." }, { "role": "assistant", "content": "SELECT d.doctor_id,\n d.first_name,\n d.last_name,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number...
[ { "role": "user", "content": "Which game has the longest total session time across all its sessions?" }, { "role": "assistant", "content": "SELECT game_id, SUM(duration_seconds) AS total_session_time\nFROM gaming_technology.game_sessions\nGROUP BY game_id\nORDER BY total_session_time DESC\nLIMIT...
You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the ...
[ { "role": "user", "content": "Show me all claim documents that are medical reports and were uploaded in the last 3 months, along with their file sizes and claim IDs." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_size_bytes, uploaded_at FROM insurance.claim_documents 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 insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ...
[ { "role": "user", "content": "List all servers that are currently marked with a 'offline' status." }, { "role": "assistant", "content": "SELECT server_id, server_name, region FROM gaming_technology.servers WHERE status = 'offline';" }, { "role": "user", "content": "For those offline ...
You are an SQL statement expert. Given the table 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": "Find all peers that haven't been active for more than 30 days, along with their IP addresses." }, { "role": "assistant", "content": "SELECT peer_id, ip_address FROM trading_platform.peers WHERE last_seen < NOW() - INTERVAL '30 days'" }, { "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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "For each player, can you find the username and registration_date of the player who registered immediately before them in the same country?" }, { "role": "assistant", "content": "SELECT p.player_id,\n p.username AS current_username,\n p.registration_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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "For each vehicle, find the vehicle acquired immediately before it in the same depot. Show current vehicle_id, acquisition_date, previous_vehicle_id, and previous_acquisition_date." }, { "role": "assistant", "content": "SELECT v.vehicle_id,\n v.acquisition_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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "What is the current number of passengers at station with ID 'ST123' right now?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the current number of passengers at a station. The data I have access to only includes static details ...
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": "For each account type and status, can you show the total number of accounts and their combined balance per currency?" }, { "role": "assistant", "content": "SELECT account_type, status, currency, COUNT(*) AS total_accounts, SUM(balance) AS total_balance\nFROM financi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac...
[ { "role": "user", "content": "Show me the total number of trades and the total traded value for each customer, including their first and last names." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name, COUNT(t.trade_id) AS trade_count, SUM(t.total_amount) 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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "I need to find all pairs of documents that were uploaded by the same lawyer within 7 days of each other." }, { "role": "assistant", "content": "SELECT a.uploaded_by_lawyer_id,\n a.document_id AS doc1_id,\n b.document_id AS doc2_id,\n a.upload_times...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id character varying(64) NOT NULL, case_id character varying(64) NOT NULL, document...
[ { "role": "user", "content": "Show me the contract addresses and their deployer addresses for contracts deployed on the 'ethereum' network, sorted by deployment timestamp in descending order." }, { "role": "assistant", "content": "SELECT address, deployer_address FROM web3.contracts WHERE networ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Show me all active managers along with their property names and the number of staff they supervise." }, { "role": "assistant", "content": "SELECT m.staff_id, CONCAT(m.first_name, ' ', m.last_name) AS manager_name, p.property_name, COUNT(s.staff_id) AS supervised_sta...
You are an SQL statement expert. Given the table 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": "Find all documents that have a description and list their document ID, file name, and description." }, { "role": "assistant", "content": "SELECT document_id, file_name, description FROM insurance.claim_documents WHERE description IS NOT NULL AND description != '';" ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "Find guests who have made at least one payment using a 'CreditCard'. List their full name (first and last name) and email address." }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name, T1.last_name, T1.email FROM hospitality_technology.guests AS T1 J...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil...
[ { "role": "user", "content": "List all Sui NFT collections where the owner is not null, including their name and collection_type." }, { "role": "assistant", "content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL;" }, { "role": "user", "content": "Can you also ...
You are an SQL statement expert. Given the table 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(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "List all plan names and their contact numbers for plans of type 'HMO' offered by 'Sunrise Insurance'." }, { "role": "assistant", "content": "SELECT plan_name, contact_phone FROM healthcare.insurance_plans WHERE plan_type = 'HMO' AND insurance_provider = 'Sunrise Ins...
You are an SQL statement expert. Given the table 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": "Find pairs of documents in the same case where one document is version 1 and the other is the highest version for that document_name, showing case_id, document_name, version1, latest_version, version1_upload_timestamp, and latest_upload_timestamp." }, { "role": "assista...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "Show me reviews from 'Expedia' that have an overall rating of 1 or 2." }, { "role": "assistant", "content": "SELECT review_id, property_id, guest_id, rating_overall, review_date, comment FROM hospitality_technology.reviews WHERE review_source = 'Expedia' AND rating_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i...
[ { "role": "user", "content": "Which doctors have issued prescriptions with a route of 'Oral'? Please show doctor_id and the number of such prescriptions they have written." }, { "role": "assistant", "content": "SELECT doctor_id, COUNT(*) AS oral_prescription_count\nFROM healthcare.prescriptions\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, -- unique identifier for the prescriptio...
[ { "role": "user", "content": "What is the total market cap for all tokens listed on the 'Polygon' chain?" }, { "role": "assistant", "content": "SELECT SUM(market_cap) FROM token_dexpool_info WHERE chain = 'Polygon';" }, { "role": "user", "content": "Only sum the market cap for tokens...
You are an SQL statement expert. Given the table 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, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "Show me the top 5 players by their average game session score, including their username and calculated average score." }, { "role": "assistant", "content": "SELECT p.username,\n AVG(gs.score) AS average_score\nFROM gaming_technology.players p\nJOIN gaming_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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "List all achievements with their name, points, and the title of the game they belong to." }, { "role": "assistant", "content": "SELECT a.name AS achievement_name, a.points, g.title AS game_title FROM gaming_technology.achievements a JOIN games g ON a.game_id = g.gam...
You are an SQL statement expert. Given the table 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.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url t...
[ { "role": "user", "content": "For each sender and recipient pair, show the total number of transfers and the sum of value sent between them." }, { "role": "assistant", "content": "SELECT from_address, to_address, COUNT(*) AS transfer_count, SUM(value) AS total_value\nFROM web3.token_transfers\nG...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id.text, token_id.text, from_address.text, to_address.text, value.numeric, transaction_...
[ { "role": "user", "content": "List developer names and founded years for developers founded between 2000 and 2010." }, { "role": "assistant", "content": "SELECT name, founded_year FROM gaming_technology.developers WHERE founded_year BETWEEN 2000 AND 2010;" }, { "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 gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_...
[ { "role": "user", "content": "Show policy numbers and product names for all policies that started in 2023." }, { "role": "assistant", "content": "SELECT p.policy_number, ip.product_name FROM insurance.policies AS p JOIN insurance.insurance_products AS ip ON p.product_id = ip.product_id WHERE dat...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "Can you list the number of appointments scheduled by each citizen, showing their first and last name?" }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, COUNT(a.appointment_id) AS appointment_count\nFROM government_services.citizens c\nLEFT JOI...
You are an SQL statement expert. Given the table 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 each product_type along with the most expensive active product in that type, showing product_type, product_id, product_name, and base_premium." }, { "role": "assistant", "content": "SELECT product_type, product_id, product_name, base_premium\nFROM (\n SELECT p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,...
[ { "role": "user", "content": "I need a report showing the count of drivers per status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS driver_count\nFROM transportation.drivers\nGROUP BY status;" }, { "role": "user", "content": "Actually, only include statuses that ...
You are an SQL statement expert. Given the table 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 usernames and updated_at timestamps for users updated after June 1, 2024." }, { "role": "assistant", "content": "SELECT username, updated_at FROM social_media.users WHERE updated_at > '2024-06-01';" }, { "role": "user", "content": "Actually, only in...
You are an SQL statement expert. Given the table 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 the contract_id and creator_address for all smart contracts created after January 1st, 2023, along with the total number of contracts each creator has created." }, { "role": "assistant", "content": "SELECT s.contract_id, s.creator_address, creator_count.total_c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.smart_contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the smart contra...
[ { "role": "user", "content": "Show me the total fare collected from all completed bookings (status = 'completed') grouped by passenger_id." }, { "role": "assistant", "content": "SELECT passenger_id, SUM(fare) AS total_fare FROM transportation.bookings WHERE status = 'completed' GROUP BY passenge...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, passenger_id text, trip_id text, seat_number text, booking_time ...
[ { "role": "user", "content": "List all pairs of events that occurred within the same transaction but were emitted by different contracts. Show the transaction ID, the IDs and names of both events, and the IDs of the contracts that emitted them." }, { "role": "assistant", "content": "SELECT t1.tr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for the event contract_id characte...
[ { "role": "user", "content": "Show the total count of appointments for each unique status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM healthcare.appointments GROUP BY status;" }, { "role": "user", "content": "Now, only show the statuses where the count is gre...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.appointments ( appointment_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc...
[ { "role": "user", "content": "For each doctor, count the number of chronic diagnoses they have made. Show the doctor's full name and the count." }, { "role": "assistant", "content": "SELECT doc.first_name, doc.last_name, COUNT(d.diagnosis_id) FROM healthcare.doctors doc JOIN healthcare.diagnoses...
You are an SQL statement expert. Given the table 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 the user ID, username, and email for all users." }, { "role": "assistant", "content": "SELECT user_id, username, email FROM blockchain.users;" }, { "role": "user", "content": "Now, only show the users whose username starts with 'alpha'." }, {...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.users ( user_id.text, username.text, email.text, password_hash.text )
[ { "role": "user", "content": "Show me all reservations with more than 2 adults that are confirmed (status = 'Confirmed'), including their check-in dates and total amounts, along with the guest's first and last name." }, { "role": "assistant", "content": "SELECT r.reservation_id, r.check_in_date,...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i...