system
stringlengths
315
8.44k
conversations
listlengths
2
8
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 legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, c...
[ { "role": "user", "content": "Show me all appointments where the lawyer_id matches the client_id, and display the appointment_id, start_time, and status.", "sql": null }, { "role": "assistant", "content": "SELECT appointment_id, start_time, status FROM legal_services.appointments WHERE lawye...
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 government_services.citizens ( citizen_id character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "List the number of applications submitted by each citizen.", "sql": null }, { "role": "assistant", "content": "SELECT c.citizen_id, c.first_name, c.last_name, COUNT(a.application_id) AS application_count\nFROM government_services.citizens c\nLEFT JOIN government...
You are an expert in writing database language and you can refuse the user's question if the question is not related to the table structure. 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 CREA...
[ { "role": "user", "content": "What is the schedule of trains arriving at station with ID 'ST789' tomorrow?", "sql": null }, { "role": "assistant", "content": "I'm sorry, but I can't provide the train schedule for station ID 'ST789' as this information is not available in the current database...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.n...
[ { "role": "user", "content": "List the total value and count of transactions for each status, ordered by total value descending.", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS transaction_count, SUM(value) AS total_value\nFROM web3.transactions\nGROUP BY statu...
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 legal_services.cases ( case_id character varying(64) NOT NULL, -- unique identi...
[ { "role": "user", "content": "List all documents which have a version greater than 2, along with the case number and name.", "sql": null }, { "role": "assistant", "content": "SELECT d.document_id, d.document_name, d.version, c.case_number, c.case_name\nFROM legal_services.documents d\nJOIN l...
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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Show me the average base rate for each room type across all properties. Include the room type name and the calculated average rate.", "sql": null }, { "role": "assistant", "content": "SELECT type_name, AVG(base_rate) FROM hospitality_technology.room_types GROUP ...
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 transportation.passengers ( passenger_id character varying(64) NOT NULL, -- uni...
[ { "role": "user", "content": "Show the first and last name of each passenger along with the total number of bookings they have made.", "sql": null }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, COUNT(b.booking_id) AS booking_count FROM transportation.passengers p LEF...
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 healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id charac...
[ { "role": "user", "content": "Show me all diagnoses that correspond to a medication based on matching the diagnosis_code with the medication's NDC code, and include diagnosis_id, patient_id, diagnosis_date, medication_name, and status.", "sql": null }, { "role": "assistant", "content": "SELE...
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 gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT ...
[ { "role": "user", "content": "Which achievement_id was unlocked the most times in the first quarter of 2024?", "sql": null }, { "role": "assistant", "content": "SELECT achievement_id, COUNT(*) as unlock_count FROM gaming_technology.player_achievements WHERE unlocked_at >= '2024-01-01 00:00:0...
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 social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "For conversation 'C100', list participant usernames and when they last read the conversation.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, cp.last_read_at\nFROM social_media.conversation_participants cp\nJOIN social_media.users u ON cp....
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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "List all replacement policies where a customer received a new policy starting the day after their previous policy was cancelled. Return customer_id, original_policy_id, original_cancellation_date, new_policy_id, new_start_date.", "sql": null }, { "role": "assistant"...
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 social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_...
[ { "role": "user", "content": "Show me a list of comments and the names of hashtags associated with the posts those comments are on.", "sql": null }, { "role": "assistant", "content": "SELECT T1.comment_id, T3.tag_name FROM comments AS T1 JOIN post_hashtags AS T2 ON T1.post_id = T2.post_id JO...
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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "Show me all policies that have at least two premium payments associated with them, along with the total amount paid for each policy.", "sql": null }, { "role": "assistant", "content": "SELECT p.policy_id, p.policy_number, COUNT(pp.payment_id) AS payment_count, S...
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 transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name te...
[ { "role": "user", "content": "Find each driver_id, first_name, last_name, and count of trips they have driven where the origin city is 'Los Angeles'.", "sql": null }, { "role": "assistant", "content": "SELECT d.driver_id, d.first_name, d.last_name, COUNT(t.trip_id) AS trip_count\nFROM transp...
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 social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "I need a list of users who have commented on their own posts. For each, return user_id, username, and the total number of such comments, ordered by comment count descending.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id,\n u.username...
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 insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agenc...
[ { "role": "user", "content": "List agents who were hired after 2020 and have a commission rate greater than 0.07.", "sql": null }, { "role": "assistant", "content": "SELECT agent_id, first_name, last_name, hire_date, commission_rate FROM insurance.agents WHERE hire_date > '2020-12-31' AND co...
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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_bir...
[ { "role": "user", "content": "Find the total number of unique document types stored in the claim_documents table.", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT document_type) FROM insurance.claim_documents;", "sql": null } ]
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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name 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.", "sql": null }, { "role": "assistant", "content": "SELECT CONCAT(l.first_name, ' ', l.last_name) AS lawyer_name, l.specialization, COUNT(c.case_id...
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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, da...
[ { "role": "user", "content": "Retrieve each customer_id, first_name, last_name, and close_price for market_data entries that occurred on the day of their account creation.", "sql": null }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name, md.close_price FROM...
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 transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name te...
[ { "role": "user", "content": "For each driver status, find the earliest and latest hire date. Show status, earliest hire date, and latest hire date.", "sql": null }, { "role": "assistant", "content": "SELECT\n status,\n MIN(hire_date) AS earliest_hire_date,\n MAX(hire_date) AS latest_hire...
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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transacti...
[ { "role": "user", "content": "How many NFTs are currently held for each contract address and token ID? Please show contract address, token id, and total amount held.", "sql": null }, { "role": "assistant", "content": "SELECT contract_address, token_id, SUM(CAST(amount AS BIGINT)) as total_he...
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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text...
[ { "role": "user", "content": "Show all payments along with the guest's first and last name, and the staff member who processed each payment. Include payment_id, amount, currency_code, payment_timestamp, guest first_name, guest last_name, staff first_name, and staff last_name.", "sql": null }, { ...
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 social_media.comments ( comment_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "Show me the usernames of users who have commented on posts that were created in group chat conversations, along with the names of those group chats.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, c.group_name\nFROM social_media.comments c...
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 hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id t...
[ { "role": "user", "content": "List all pairs of overlapping reservations at the same property, including both reservation IDs and the overlap duration in days.", "sql": null }, { "role": "assistant", "content": "select r1.reservation_id as reservation1_id, r2.reservation_id as reservation2_i...
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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "Get the usernames of users who have created any public posts, and count how many public posts each user has made. Order the results by the post count in descending order.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, COUNT(p.post_id) AS ...
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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_i...
[ { "role": "user", "content": "Show me the total paid amount and the number of premium payments per customer for policies that have at least one payment over $5000.", "sql": null }, { "role": "assistant", "content": "SELECT customer_id, SUM(amount_paid) AS total_paid, COUNT(*) AS payment_coun...
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 social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, par...
[ { "role": "user", "content": "List all group conversations that have at least one unread notification, include the conversation ID, group name, and the count of unread notifications as unread_count.", "sql": null }, { "role": "assistant", "content": "SELECT c.conversation_id, c.group_name, C...
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "Show the reservation ID, property name, and room type name for all reservations with a status of 'Confirmed'.", "sql": null }, { "role": "assistant", "content": "SELECT T1.reservation_id, T2.property_name, T3.type_name FROM hospitality_technology.reservations AS...
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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "List each game and the number of unique in-game items available for it.", "sql": null }, { "role": "assistant", "content": "SELECT T1.title, count(T2.item_id) FROM gaming_technology.games AS T1 LEFT JOIN gaming_technology.in_game_items AS T2 ON T1.game_id = T2.g...
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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "Show me all drivers and the vehicles they are assigned for trips that have status 'Delayed'. Include driver first_name, driver last_name, vehicle license_plate, trip_id, and actual_departure.", "sql": null }, { "role": "assistant", "content": "SELECT d.first_nam...
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 government_services.employees ( employee_id.text, agency_id.text, first_name.text, l...
[ { "role": "user", "content": "Find all currently employed staff whose managers are no longer employed. Show the employee's full name, hire date, the manager's full name, and the manager's termination_date.", "sql": null }, { "role": "assistant", "content": "SELECT e.first_name || ' ' || e.la...
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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "List all servers, showing their name, region, and current number of players.", "sql": null }, { "role": "assistant", "content": "SELECT server_name, region, current_players FROM gaming_technology.servers;", "sql": null }, { "role": "user", "conte...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key t...
[ { "role": "user", "content": "For each wallet, find the previous wallet created by the same user. Show current wallet_id, previous_wallet_id, user_id, and the difference in days between their creation dates.", "sql": null }, { "role": "assistant", "content": "SELECT\n wallet_id AS current_w...
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 transportation.routes ( route_id.text, route_number.text, description.text, origin_l...
[ { "role": "user", "content": "Show all routes where the description mentions the word 'airport'.", "sql": null }, { "role": "assistant", "content": "SELECT route_id, route_number, description, origin_location_id, destination_location_id, distance_km, estimated_duration_minutes, type\nFROM tr...
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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character...
[ { "role": "user", "content": "How many claims were reported in the last 90 days?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM claims WHERE reported_date >= CURRENT_DATE - INTERVAL '90 days'", "sql": null } ]
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 social_media.user_settings ( setting_id.text, user_id.text, theme.text, email_notifi...
[ { "role": "user", "content": "List the user ID, theme, and updated_at for users who have updated their settings in the last 90 days and have their theme set to 'dark'.", "sql": null }, { "role": "assistant", "content": "SELECT user_id, theme, updated_at FROM social_media.user_settings WHERE ...
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 social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "Show all users whose full name starts with 'A' and who have updated their profile in June 2024. Please include their usernames and updated_at timestamps.", "sql": null }, { "role": "assistant", "content": "SELECT username, updated_at FROM social_media.users WHER...
You are an expert in writing database language and you can refuse the user's question if the question is not related to the table structure. 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 CREA...
[ { "role": "user", "content": "What is the fuel consumption rate of train number T1234?", "sql": null }, { "role": "assistant", "content": "I'm sorry, but I don't have information on the fuel consumption rate of train number T1234. The data available in the system only includes details such a...
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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name charac...
[ { "role": "user", "content": "Show me all clients together with the names of the lawyers who have handled cases for them and the case names.", "sql": null }, { "role": "assistant", "content": "SELECT c.client_id, c.first_name || ' ' || c.last_name AS client_full_name, l.first_name || ' ' || ...
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 transportation.routes ( route_id text, route_number text, description text, origin_l...
[ { "role": "user", "content": "Show the route number, route type, and the names of the origin and destination locations for all routes.", "sql": null }, { "role": "assistant", "content": "SELECT r.route_number, r.type, l1.name AS origin_name, l2.name AS destination_name\nFROM transportation.r...
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 gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region t...
[ { "role": "user", "content": "Can you show me the number of servers in each region, as well as the total max_players for each region?", "sql": null }, { "role": "assistant", "content": "SELECT region, COUNT(*) AS server_count, SUM(max_players) AS total_max_players FROM gaming_technology.serv...
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 character varying(64) NOT NULL, username character varyin...
[ { "role": "user", "content": "Find all email addresses that are used by more than one user, and list the email address along with the count of users sharing it.", "sql": null }, { "role": "assistant", "content": "SELECT email, COUNT(user_id) FROM blockchain.users GROUP BY email HAVING COUNT(...
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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text...
[ { "role": "user", "content": "Show each room type with their maximum occupancy and the total number of rooms of that type across all properties.", "sql": null }, { "role": "assistant", "content": "SELECT rt.room_type_id, rt.type_name, rt.max_occupancy, COUNT(r.room_id) AS total_rooms \nFROM ...
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 financial_services.market_data ( data_point_id bigserial NOT NULL, -- auto-incre...
[ { "role": "user", "content": "For each security issuer, show the count of market data points and the average close price for their securities.", "sql": null }, { "role": "assistant", "content": "SELECT T2.issuer_name, COUNT(T1.*) AS data_point_count, AVG(T1.close_price) AS avg_close_price FR...
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 healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.t...
[ { "role": "user", "content": "I need a list showing each patient along with their current primary insurance policy number and their immediately previous primary policy number.", "sql": null }, { "role": "assistant", "content": "SELECT ci.patient_id,\n ci.policy_number AS current_policy...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token...
[ { "role": "user", "content": "Calculate the total PNL and total Net Flow for all tokens recorded on the 'Arbitrum' chain.", "sql": null }, { "role": "assistant", "content": "SELECT SUM(pnl) as total_pnl, SUM(net_flow) as total_net_flow FROM smart_money_token_performance WHERE chain = 'Arbitr...
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 gaming_technology.developers ( developer_id uuid NOT NULL DEFAULT gen_random_uui...
[ { "role": "user", "content": "Show for each developer and inventory item combination the number of times that item appears in player inventories.", "sql": null }, { "role": "assistant", "content": "SELECT d.developer_id, d.name AS developer_name, pi.item_id, COUNT(pi.inventory_id) AS invento...
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 healthcare.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_pro...
[ { "role": "user", "content": "Show me all pairs of plans offered by the same insurance provider but of different plan types, including the provider name, first plan ID and type, and second plan ID and type.", "sql": null }, { "role": "assistant", "content": "SELECT a.insurance_provider,\n ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), usern...
[ { "role": "user", "content": "For each player and game pair, please show the total number of achievements unlocked by the player in that game.", "sql": null }, { "role": "assistant", "content": "SELECT gs.player_id, gs.game_id, COUNT(pa.achievement_id) AS achievements_unlocked\nFROM gaming_t...
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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, passwo...
[ { "role": "user", "content": "List the names and symbols of all assets that have at least one associated metadata entry in the metadata table.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT T1.name, T1.symbol FROM trading_platform.assets AS T1 JOIN trading_platform.metad...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_a...
[ { "role": "user", "content": "Find token transfers that correspond directly to an event log (same transaction and log index). List the transfer ID, value, and the event name.", "sql": null }, { "role": "assistant", "content": "SELECT T1.transfer_id, T1.value, T2.event_name FROM web3.token_tr...
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 financial_services.accounts ( account_id text, customer_id text, account_number text...
[ { "role": "user", "content": "List accounts that were opened in the same month and year as another account for the same customer, but have a different account type. Show the account_id, customer_id, account_type, and opened_date for these accounts.", "sql": null }, { "role": "assistant", "co...
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 social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media...
[ { "role": "user", "content": "List all post IDs and the corresponding hashtag names where posts were created near latitude 40.0 and longitude -74.0.", "sql": null }, { "role": "assistant", "content": "SELECT p.post_id, h.tag_name\nFROM social_media.posts p\nJOIN social_media.post_hashtags ph...
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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_bir...
[ { "role": "user", "content": "Show the total number of policies in each status.", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM insurance.policies GROUP BY status", "sql": null } ]
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 legal_services.law_firms ( firm_id text PRIMARY KEY, firm_name text, address text, p...
[ { "role": "user", "content": "List all pairs of law firms founded in the same year, showing both firm names and their shared founding year.", "sql": null }, { "role": "assistant", "content": "SELECT lf1.firm_name AS firm1, lf2.firm_name AS firm2, EXTRACT(YEAR FROM lf1.founded_date) AS founde...
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 legal_services.clients ( client_id text, first_name text, last_name text, company_na...
[ { "role": "user", "content": "List all client-lawyer pairs who share the same email domain, showing the client's first and last name, the lawyer's first and last name, and the email domain.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name AS client_first_name, c.last_n...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created...
[ { "role": "user", "content": "List the wallet IDs and creation timestamps for all wallets created after '2023-01-01'.", "sql": null }, { "role": "assistant", "content": "SELECT wallet_id, created_at FROM web3.wallets WHERE created_at > '2023-01-01';", "sql": null }, { "role": "us...
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 legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case...
[ { "role": "user", "content": "Show me all invoices for case_id 'case_777', including the invoice number, total amount, and status.", "sql": null }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, status FROM legal_services.invoices WHERE case_id = 'case_777';", "s...
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 healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "For each patient and medication combination, how many times has that patient been prescribed each medication? Only show combinations that occurred at least 3 times.", "sql": null }, { "role": "assistant", "content": "SELECT patient_id, medication_id, COUNT(*) AS...
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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name characte...
[ { "role": "user", "content": "List each patient's first and last name along with the insurance plan name they are enrolled in, including only primary policies. Return patient_id, first_name, last_name, and plan_name.", "sql": null }, { "role": "assistant", "content": "SELECT p.patient_id,\n ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.passengers ( passenger_id character varying(64) NOT NULL, first_name ...
[ { "role": "user", "content": "For each passenger, show their passenger_id, first_name, last_name, and the count of other passengers in the same loyalty_program_id.", "sql": null }, { "role": "assistant", "content": "SELECT p1.passenger_id, p1.first_name, p1.last_name, COUNT(p2.passenger_id) ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Show me all failed transactions where the gas_used is greater than 100,000, including the transaction_id and timestamp.", "sql": null }, { "role": "assistant", "content": "SELECT transaction_id, timestamp FROM web3.transactions WHERE status = 'failed' AND gas_us...
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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate c...
[ { "role": "user", "content": "List all bookings, including the passenger ID, booking ID, booking time, and the name of the origin and destination locations for the trip.", "sql": null }, { "role": "assistant", "content": "SELECT b.passenger_id, b.booking_id, b.booking_time, o.name AS origin_...
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 gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_y...
[ { "role": "user", "content": "List all developer names and their websites.", "sql": null }, { "role": "assistant", "content": "SELECT name, website FROM gaming_technology.developers;", "sql": null }, { "role": "user", "content": "Can you only include developers whose website ...
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 gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- un...
[ { "role": "user", "content": "List each genre and the number of games in that genre.", "sql": null }, { "role": "assistant", "content": "SELECT genre,\n COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY genre;", "sql": null }, { "role": "user", "content": "...
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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number...
[ { "role": "user", "content": "Give me the number of lawyers and average tenure in years for each specialization.", "sql": null }, { "role": "assistant", "content": "SELECT specialization,\n COUNT(*) AS lawyer_count,\n AVG(DATE_PART('year', AGE(CURRENT_DATE, hire_date))) AS avg_te...
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.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp tim...
[ { "role": "user", "content": "Show me all smart contracts along with the email address of the user who owns the wallet corresponding to the contract's creator address.", "sql": null }, { "role": "assistant", "content": "SELECT sc.contract_id, sc.creator_address, u.email\nFROM blockchain.smar...
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 government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name...
[ { "role": "user", "content": "List the reference number and status for all applications that have at least one document associated with them.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT a.reference_number, a.status FROM government_services.applications AS a JOIN gover...
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 social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "List all comments on a given post along with the commenter’s username and the comment time.", "sql": null }, { "role": "assistant", "content": "SELECT c.comment_id, c.content, u.username, c.created_at\nFROM social_media.comments c\nJOIN social_media.users u ON c...
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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch...
[ { "role": "user", "content": "How many approval-for-all events have been recorded for each ERC1155 contract address?", "sql": null }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) AS approval_count\nFROM erc1155_approval_for_all\nGROUP BY contract_address;", "sql":...
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 transportation.routes ( route_id.text, route_number.text, description.text, origin_l...
[ { "role": "user", "content": "List all routes showing the route_number, origin_location_id, destination_location_id, distance_km, and type.", "sql": null }, { "role": "assistant", "content": "SELECT\n route_number,\n origin_location_id,\n destination_location_id,\n distance_km,\n type\n...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.assets ( asset_id character varying(64) NOT NULL, name character va...
[ { "role": "user", "content": "Find transaction IDs in the utxos table that have both spent and unspent UTXOs associated with them. List these transaction IDs.", "sql": null }, { "role": "assistant", "content": "SELECT transaction_id FROM trading_platform.utxos GROUP BY transaction_id HAVING ...
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 social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "List all hashtags and for each, show how many different users have created posts using that hashtag.", "sql": null }, { "role": "assistant", "content": "SELECT ph.hashtag_id, COUNT(DISTINCT p.user_id) AS unique_user_count\nFROM social_media.post_hashtags ph\nJOI...
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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_bir...
[ { "role": "user", "content": "List the policy number, start date, product name, and base premium for policies where the base premium of the associated product is greater than 1000.", "sql": null }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.start_date, T2.product_name, T2...
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 transportation.routes ( route_id text PRIMARY KEY, route_number text, description te...
[ { "role": "user", "content": "Find all pairs of origin and destination cities, along with their route_number and distance, where the estimated duration is less than 90 minutes.", "sql": null }, { "role": "assistant", "content": "SELECT route_number, origin_location_id, destination_location_i...
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 trading_platform.users ( user_id character varying(64) NOT NULL, username character ...
[ { "role": "user", "content": "Show me the top 5 users who have interacted with DApps, along with the count of distinct DApps they interacted with and their email addresses.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id, u.email, COUNT(DISTINCT l.details) AS dapp_count ...
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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, prop...
[ { "role": "user", "content": "Show me the list of all guests who have reservations along with the room number, room type name, and property name for each reservation.", "sql": null }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, r.room_number, rt.type_name AS room_typ...
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 legal_services.law_firms ( firm_id text PRIMARY KEY, firm_name text, address text, p...
[ { "role": "user", "content": "List the names of law firms whose managing partner has uploaded at least one document, and show the managing partner ID along with the firm's phone number.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT T1.firm_name, T1.managing_partner_id, ...
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 legal_services.law_firms ( firm_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Can you provide a list of all law firms, including their address and phone number?", "sql": null }, { "role": "assistant", "content": "SELECT firm_id, firm_name, address, phone FROM legal_services.law_firms;", "sql": null }, { "role": "user", "co...
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 gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- un...
[ { "role": "user", "content": "Can you provide a list of each game's title along with the total quantity of all items players have in their inventory for that game?", "sql": null }, { "role": "assistant", "content": "SELECT g.title, SUM(pi.quantity) AS total_item_quantity\nFROM gaming_technol...
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.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp tim...
[ { "role": "user", "content": "List all smart contracts created by addresses that have a balance greater than 1000.", "sql": null }, { "role": "assistant", "content": "SELECT sc.* FROM blockchain.smart_contracts sc JOIN blockchain.addresses a ON sc.creator_address = a.address_id WHERE a.balan...
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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "List the username and email of users who have disabled push notifications.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, u.email\nFROM social_media.users u\nJOIN social_media.user_settings s ON u.user_id = s.user_id\nWHERE s.push_notific...
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 gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT ...
[ { "role": "user", "content": "List all pairs of players who unlocked the same achievement, showing achievement_id, player1_id, player2_id, and player1_unlocked_at.", "sql": null }, { "role": "assistant", "content": "SELECT pa1.achievement_id,\n pa1.player_id AS player1_id,\n pa2....
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 gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, ...
[ { "role": "user", "content": "Can you show me how many achievements each player unlocks per day? Return player_id, unlock_date, and achievement_count.", "sql": null }, { "role": "assistant", "content": "SELECT player_id,\n CAST(unlocked_at AS date) AS unlock_date,\n COUNT(*) AS a...
You are an expert in writing database language and you can refuse the user's question if the question is not related to the table structure. 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 CREA...
[ { "role": "user", "content": "What are the fuel consumption rates per hour for the Boeing 747-8 model?", "sql": null }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the a...
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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text...
[ { "role": "user", "content": "List all distinct asset types from the assets table.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT type\nFROM trading_platform.assets;", "sql": null } ]
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "For each transaction, show the transaction id and the total number of unique addresses involved in token transfers for that transaction (both as sender and receiver).", "sql": null }, { "role": "assistant", "content": "SELECT transaction_id, COUNT(DISTINCT addr)...
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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birt...
[ { "role": "user", "content": "List all patients who have received a prescription with the route 'Topical', showing their ID, first name, and last name.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT\n p.patient_id,\n p.first_name,\n p.last_name\nFROM\n health...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id.text, block_id.text, sender_address.text, r...
[ { "role": "user", "content": "Show me each transaction ID along with the sender's public key, the receiver's balance, and the transaction amount.", "sql": null }, { "role": "assistant", "content": "SELECT t.transaction_id, a_sender.public_key AS sender_public_key, a_receiver.balance AS recei...
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 gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, ser...
[ { "role": "user", "content": "Show all in-game items (name, rarity) that belong to games where the average session score across all sessions for that game is greater than 300.", "sql": null }, { "role": "assistant", "content": "SELECT ii.item_name, ii.rarity FROM gaming_technology.in_game_it...
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 government_services.services ( service_id text PRIMARY KEY, agency_id text, service_...
[ { "role": "user", "content": "Find for each category the service with the highest standard_fee and the service with the lowest standard_fee. Display the category, highest_fee_service, and lowest_fee_service.", "sql": null }, { "role": "assistant", "content": "SELECT m.category,\n s_max...
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 insurance.customers ( customer_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "I need to find, for each active agent, the number of active policies they have sold and the average premium_amount of those active policies.", "sql": null }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name || ' ' || a.last_name AS agent_name, ...
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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "List diagnoses and the name of any medication mentioned in the treatment plan of the associated medical record. Show diagnosis ID, diagnosis description, medication name, and record ID.", "sql": null }, { "role": "assistant", "content": "SELECT T1.diagnosis_id, ...
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 token_basic_info ( coin_id character varying(100) NOT NULL, token_name character var...
[ { "role": "user", "content": "Show the top 3 tokens on Polygon with the greatest positive price change over the last 6 hours, including their symbol, price, 6h change, and the number of smart money buy addresses in the last 24h.", "sql": null }, { "role": "assistant", "content": "SELECT tdi....
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 hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id t...
[ { "role": "user", "content": "List each reservation along with the next reservation for the same guest. Show the original reservation_id, its check_out_date, the next_reservation_id, and the next reservation's check_in_date.", "sql": null }, { "role": "assistant", "content": "SELECT r1.reser...
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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text,...
[ { "role": "user", "content": "List all policies where the premium_amount exceeds the base_premium of its insurance product. Display the policy_number, premium_amount, product_name, and base_premium. Sort the results by premium_amount descending.", "sql": null }, { "role": "assistant", "conte...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi...
[ { "role": "user", "content": "For each deployer address, show the total supply of all tokens created by the contracts they deployed.", "sql": null }, { "role": "assistant", "content": "SELECT c.deployer_address, SUM(t.total_supply) AS total_token_supply\nFROM web3.contracts c\nJOIN web3.toke...
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 legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number...
[ { "role": "user", "content": "List each partner’s full name along with the full name of a non-partner lawyer in the same firm.", "sql": null }, { "role": "assistant", "content": "SELECT p.lawyer_id,\n CONCAT(p.first_name, ' ', p.last_name) AS partner_full_name,\n CONCAT(n.first_n...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, da...
[ { "role": "user", "content": "Find all pairs of customers who live in the same state but have different risk profiles.", "sql": null }, { "role": "assistant", "content": "SELECT a.customer_id AS customer_id_a, a.first_name || ' ' || a.last_name AS full_name_a, a.risk_profile AS risk_profile_...
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 insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character vary...
[ { "role": "user", "content": "List all beneficiaries who hold more than 25% of a policy, showing their beneficiary ID, full name, and contact information.", "sql": null }, { "role": "assistant", "content": "SELECT beneficiary_id, first_name, last_name, contact_info\nFROM insurance.policy_ben...