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 hospitality_technology.reviews ( review_id.text, property_id.text, reservation_id.te...
[ { "role": "user", "content": "Get each review with the next review date for the same guest.", "sql": null }, { "role": "assistant", "content": "SELECT guest_id, review_id, review_date,\n LEAD(review_date) OVER (PARTITION BY guest_id ORDER BY review_date) AS next_review_date\nFROM hospi...
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": "Show me the full name and specialization of all lawyers, along with the name of the law firm they work for.", "sql": null }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.specialization, T2.firm_name FROM legal_services.lawyers AS T1 ...
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, username text, email text, password_hash...
[ { "role": "user", "content": "Show the name of each developer and the titles of all games they have released.", "sql": null }, { "role": "assistant", "content": "SELECT d.name AS developer_name, g.title AS game_title\nFROM gaming_technology.developers d\nJOIN gaming_technology.games g ON g.d...
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(), -...
[ { "role": "user", "content": "How many players are there in each country?", "sql": null }, { "role": "assistant", "content": "SELECT country_code, COUNT(*) AS player_count\nFROM gaming_technology.players\nGROUP BY country_code;", "sql": null }, { "role": "user", "content": "O...
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": "Could you list games developed by companies founded in 'Germany' and show the game title, platform, and the developer's name?", "sql": null }, { "role": "assistant", "content": "SELECT T1.title, T1.platform, T2.name FROM gaming_technology.games AS T1 JOIN gaming...
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": "List each user's username and the total number of trades they've participated in as buyers, including users who have not made any trades, sorted by the trade count descending.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, COUNT(t.trade_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 legal_services.documents ( document_id text, case_id text, document_name text, docum...
[ { "role": "user", "content": "Show the latest version number of each document_name for every case.", "sql": null }, { "role": "assistant", "content": "SELECT case_id,\n document_name,\n MAX(version) AS latest_version\nFROM legal_services.documents\nGROUP BY case_id, document_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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name....
[ { "role": "user", "content": "Which citizens have had both applications and appointments for services in the 'Healthcare' category? List their full name, application ID, and appointment ID.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT c.first_name || ' ' || c.last_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 smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the tok...
[ { "role": "user", "content": "How many distinct tokens did smart money buy on the 'BSC' chain in 2023?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT token_address) AS distinct_tokens_bought\nFROM smart_money_token_inflow\nWHERE type = 1\n AND chain = 'BSC'\n AND...
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.documents ( document_id text, application_id text, citizen_id te...
[ { "role": "user", "content": "List the application ID and citizen ID for all documents of type 'Proof of Address'.", "sql": null }, { "role": "assistant", "content": "SELECT application_id, citizen_id FROM government_services.documents WHERE document_type = 'Proof of Address';", "sql": 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.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "Show me a list of all vehicles along with their make, model, year, and the name of their home depot.", "sql": null }, { "role": "assistant", "content": "SELECT v.vehicle_id, v.make, v.model, v.year, v.depot_id\nFROM transportation.vehicles v;", "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 government_services.applications ( application_id text, citizen_id text, service_id ...
[ { "role": "user", "content": "Show the count of applications submitted per day for the last 7 days. Include the date and application_count, ordered by date ascending.", "sql": null }, { "role": "assistant", "content": "SELECT CAST(submitted_at AS date) AS date,\n COUNT(*) AS applicatio...
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.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, sp...
[ { "role": "user", "content": "Count the number of medications provided by the manufacturer 'Novartis'.", "sql": null }, { "role": "assistant", "content": "SELECT count(*) FROM healthcare.medications WHERE manufacturer = 'Novartis'", "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 trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, a...
[ { "role": "user", "content": "Retrieve all orders placed after '2024-06-01', including order_id, user_id, asset_id, quantity, and price.", "sql": null }, { "role": "assistant", "content": "SELECT order_id, user_id, asset_id, quantity, price\nFROM trading_platform.orders\nWHERE created_at > '...
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 me all pairs of routes where both routes have the same origin_location_id but different destination_location_id values. For each pair, display the first route's route_number, the second route's route_number, and their origin_location_id.", "sql": null }, { "rol...
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.services ( service_id character varying(64) NOT NULL, -- ...
[ { "role": "user", "content": "For each property, show the property name, average price of available services, and the maximum price of available services.", "sql": null }, { "role": "assistant", "content": "SELECT p.property_name,\n AVG(s.price) AS avg_price,\n MAX(s.price) AS ma...
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, -- unique id...
[ { "role": "user", "content": "Show the total number of notifications sent per user.", "sql": null }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS total_notifications\nFROM trading_platform.notifications\nGROUP BY user_id;", "sql": null }, { "role": "user", "...
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 pairs of patients who registered on the same day. Show patient1_id, patient1_name, patient2_id, patient2_name, and the shared registration date.", "sql": null }, { "role": "assistant", "content": "SELECT p1.patient_id AS patient1_id, p1.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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transacti...
[ { "role": "user", "content": "How many total records are there in the `erc20_approval` table?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM erc20_approval", "sql": null }, { "role": "user", "content": "And how many records are in the `erc1155_approv...
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 NOT NULL DEFAULT gen_random_uuid(), game_...
[ { "role": "user", "content": "For each server, show it alongside another server in the same region that has the closest number of current players.", "sql": null }, { "role": "assistant", "content": "SELECT\n s1.server_id AS server_a_id,\n s1.server_name AS server_a_name,\n s2.server_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 token_basic_info (", "coin_id character varying(100) NOT NULL, -- the id of th...
[ { "role": "user", "content": "Which is the token with the largest difference between its highest and lowest price in the last 24h on each chain, and what is the token's symbol and current price?", "sql": null }, { "role": "assistant", "content": "SELECT chain, token_symbol, price, (highest_p...
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": "For each city, show how many trips have started there (origin), how many have ended there (destination), and the total number of unique vehicles used in trips that started in that city.", "sql": null }, { "role": "assistant", "content": "SELECT l.city,\n 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 financial_services.trades ( trade_id character varying(64) NOT NULL, account_id char...
[ { "role": "user", "content": "Show me all trades (trade_id, security_id, total_amount) where the trade_type is 'Buy' and the execution_venue is 'NYSE', along with the loan details (loan_type, principal_amount) for accounts that have both trades and loans.", "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 gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title cha...
[ { "role": "user", "content": "Can you show me the total number of items acquired by each player, along with the title of each game and the player's ID?", "sql": null }, { "role": "assistant", "content": "SELECT pi.player_id, g.title AS game_title, SUM(pi.quantity) AS total_items_acquired\nFR...
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": "List all 'exists'-status coins from sui_coins_metadata with more than 8 decimals, showing coin_type, symbol, name, and decimals.", "sql": null }, { "role": "assistant", "content": "SELECT coin_type, symbol, name, decimals FROM sui_coins_metadata WHERE status = '...
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 patient ID, first name, last name, policy number, and plan name for all patient insurance policies that are not primary and expire after the year 2025.", "sql": null }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.po...
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.utxos ( utxo_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "How many UTXOs have the 'spent' flag set to false?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) AS unspent_utxo_count\nFROM trading_platform.utxos\nWHERE spent = false;", "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.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "Show me the usernames and the group names for each user who has sent at least one message in a group chat.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.conversation_par...
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.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_time...
[ { "role": "user", "content": "How many fuel logs were created for each unit of measurement? Show the unit and the corresponding count.", "sql": null }, { "role": "assistant", "content": "SELECT unit, COUNT(*) as log_count\nFROM transportation.fuel_logs\nGROUP BY unit;", "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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "List the full names and dates of birth of all patients whose emergency contact phone matches the phone number of any doctor.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT p.first_name, p.last_name, p.date_of_birth\nFROM healthcare.patients ...
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.room_types ( room_type_id character varying(64) NOT NULL,...
[ { "role": "user", "content": "Show each staff member's first name, last name, and the average base rate of room types available at the property where they work.", "sql": null }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.avg_base_rate FROM hospitality_technolog...
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.time_entries ( entry_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Calculate the total billable hours spent by each lawyer for entries in March 2024.", "sql": null }, { "role": "assistant", "content": "SELECT lawyer_id,\n SUM(hours_spent) AS total_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\n AND da...
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.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name characte...
[ { "role": "user", "content": "List all pairs of hashtags that were created on the same date. Show both tag names and the creation date.", "sql": null }, { "role": "assistant", "content": "SELECT a.tag_name AS tag1, b.tag_name AS tag2, a.created_at::date AS created_date\nFROM social_media.has...
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": "Show me all servers where current_players is 0, and include their server_id, server_name, and region.", "sql": null }, { "role": "assistant", "content": "SELECT server_id, server_name, region FROM gaming_technology.servers WHERE current_players = 0;", "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 gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_rand...
[ { "role": "user", "content": "What is the count of unique items acquired on each day?", "sql": null }, { "role": "assistant", "content": "SELECT DATE(acquired_at) AS acquisition_date, COUNT(DISTINCT item_id) AS unique_item_count FROM gaming_technology.player_inventory GROUP BY DATE(acquired_...
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": "List all staff members, showing their full name, position, and the name of the property where they work.", "sql": null }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.position, T2.property_name FROM hospitality_technology.staff AS T1...
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, property_id c...
[ { "role": "user", "content": "Retrieve the total revenue generated by each service.", "sql": null }, { "role": "assistant", "content": "SELECT so.service_id, SUM(so.total_price) AS total_revenue\nFROM hospitality_technology.service_orders so\nGROUP BY so.service_id;", "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 financial_services.accounts ( account_id text, customer_id text, account_number text...
[ { "role": "user", "content": "List all employees and the department their manager belongs to. Include the employee's full name.", "sql": null }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, m.department AS manager_department FROM financial_services.employees AS e LEFT...
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.staff ( staff_id text PRIMARY KEY, property_id text, first_na...
[ { "role": "user", "content": "Show all public reviews that have a comment.", "sql": null }, { "role": "assistant", "content": "SELECT review_id, property_id, guest_id, rating_overall, comment FROM reviews WHERE is_public = TRUE AND comment IS NOT NULL AND comment != '';", "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 hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, roo...
[ { "role": "user", "content": "Show me all rooms along with their current overall review rating for each room, including the room number and property id.", "sql": null }, { "role": "assistant", "content": "SELECT r.room_number, r.property_id, AVG(rv.rating_overall) AS average_overall_rating\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 blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonc...
[ { "role": "user", "content": "Find all blocks where the difficulty is between 1000 and 2000.", "sql": null }, { "role": "assistant", "content": "SELECT * FROM blockchain.blocks WHERE difficulty BETWEEN 1000 AND 2000;", "sql": null }, { "role": "user", "content": "Now filter 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 web3.transactions ( transaction_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "List all transactions where the recipient address is not specified (i.e., to_address is NULL), showing transaction_id, from_address, value, and block_number.", "sql": null }, { "role": "assistant", "content": "SELECT transaction_id, from_address, value, block_nu...
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 text, national_id_number text, first_name ...
[ { "role": "user", "content": "List all appointments showing the scheduled time, the name of the service, and the name of the location.", "sql": null }, { "role": "assistant", "content": "SELECT T1.scheduled_start_time, T2.service_name, T3.location_name FROM government_services.appointments 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 social_media.users ( user_id text, username text, email text, password_hash text, fu...
[ { "role": "user", "content": "List the usernames and email addresses of users who have set their profile to private and have chosen the 'dark' theme.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, u.email FROM social_media.users u JOIN social_media.user_settings us ON...
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 me the usernames and full names of users who are followed by someone with a verified account.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT u2.username, u2.full_name\nFROM social_media.users u1\nJOIN social_media.follows f ON u1.user_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 hospitality_technology.properties ( property_id text, property_name text, address_li...
[ { "role": "user", "content": "List the name, type, and city for all properties located in 'Canada'.", "sql": null }, { "role": "assistant", "content": "SELECT property_name, property_type, city FROM hospitality_technology.properties WHERE country_code = 'CAN';", "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 gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, ...
[ { "role": "user", "content": "For each player, calculate the total quantity of items they have acquired. Return player_id and total_quantity.", "sql": null }, { "role": "assistant", "content": "SELECT player_id,\n SUM(quantity) AS total_quantity\nFROM gaming_technology.player_inventory...
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": "Show me the top 5 games by number of online servers in European regions. I want the game title and the server count.", "sql": null }, { "role": "assistant", "content": "SELECT g.title, COUNT(s.server_id) AS server_count\nFROM gaming_technology.games g\nJOIN gami...
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 PRIMARY KEY, user_id text, theme text, ...
[ { "role": "user", "content": "Can you show me the user IDs and their theme settings for all users who have enabled email notifications and have updated their settings in 2024?", "sql": null }, { "role": "assistant", "content": "SELECT user_id, theme FROM social_media.user_settings WHERE emai...
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": "Retrieve pairs of law firms that share the same managing_partner_id, showing the firm names and the managing_partner_id.", "sql": null }, { "role": "assistant", "content": "SELECT lf1.firm_name AS firm1, lf2.firm_name AS firm2, lf1.managing_partner_id FROM legal...
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": "Show me all customers who have missing contact information (either phone number or email is null), along with their state and city.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone...
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 text, national_id_number text, first_name ...
[ { "role": "user", "content": "Which citizens have submitted more than two applications? Provide their full name and the total number of applications.", "sql": null }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS full_name,\n COUNT(*) AS application_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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "Show the first and last names, date of birth, and phone number for all patients who have provided an emergency contact.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth, phone_number\nFROM healthcare.patients\nWHERE...
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.users ( user_id text, username text, email text, password_hash text, created_at...
[ { "role": "user", "content": "Find all pairs of users who registered at exactly the same timestamp, showing both user IDs, usernames, and the shared registration timestamp.", "sql": null }, { "role": "assistant", "content": "SELECT u1.user_id AS user_id_1, u1.username AS username_1, u2.user_...
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.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appo...
[ { "role": "user", "content": "For each location, what is the average appointment duration? Show location_id and the average duration.", "sql": null }, { "role": "assistant", "content": "SELECT location_id, AVG(duration_minutes) FROM healthcare.appointments GROUP BY location_id;", "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 social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media...
[ { "role": "user", "content": "I want to get the list of users and their total number of public posts made in the last month, including user_id and post_count.", "sql": null }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS post_count\nFROM social_media.posts\nWHERE visibility...
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": "Find all pairs of transactions where the gas price of the first transaction is lower than the gas price of the second transaction, but they are both from the same sender address. Show both transaction IDs, the common sender address, and the gas price for each.", "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.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "For each user, show their username, email, and the number of posts they've created that contain at least one hashtag. Only include users who have created such posts.", "sql": null }, { "role": "assistant", "content": "SELECT u.username, u.email, COUNT(DISTINCT p...
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": "Show me all servers, the title of the game they host, and the name of the game's developer.", "sql": null }, { "role": "assistant", "content": "SELECT s.server_name, g.title AS game_title, d.name AS developer_name FROM gaming_technology.servers s JOIN gaming_tec...
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": "Which routes have a distance_km of exactly 100 and are classified as 'Intercity Train'? Please provide their route_number and description.", "sql": null }, { "role": "assistant", "content": "SELECT route_number, description\nFROM transportation.routes\nWHERE dis...
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 NOT NULL DEFAULT gen_random_uuid()...
[ { "role": "user", "content": "Can you provide the total number of sessions and the average session duration in seconds for each game_id and server_id pair?", "sql": null }, { "role": "assistant", "content": "SELECT game_id, server_id, COUNT(*) AS total_sessions, AVG(duration_seconds) AS avg_...
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.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text ) C...
[ { "role": "user", "content": "How many unique hashtags has each post been associated with? Please return post_id and unique_hashtag_count.", "sql": null }, { "role": "assistant", "content": "SELECT post_id, COUNT(DISTINCT hashtag_id) AS unique_hashtag_count\nFROM social_media.post_hashtags\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 erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, am...
[ { "role": "user", "content": "I need to know the total USD value of all ERC-20 holdings by each wallet. Calculate the sum of (amount * price) using the latest token prices from token_prices_latest, grouped by wallet_address.", "sql": null }, { "role": "assistant", "content": "SELECT eb.walle...
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 each room's number and the total amount of payments processed for that room.", "sql": null }, { "role": "assistant", "content": "SELECT r.room_number, SUM(p.amount) AS total_payments\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.payme...
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": "How many inactive insurance products are there?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) FROM insurance.insurance_products WHERE is_active = false;", "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 erc20_balances ( block_number bigint, contract_address text, wallet_address text, am...
[ { "role": "user", "content": "Show me all NFT collections on the 'Ethereum' blockchain, listing their name, contract address, and ERC type.", "sql": null }, { "role": "assistant", "content": "SELECT name, contract_address, erc_type FROM nft_collections WHERE blockchain = 'Ethereum'", "sq...
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 PRIMARY KEY, player_id uuid, game_...
[ { "role": "user", "content": "I want to see for each server region the total number of servers and the average duration of all sessions hosted in that region.", "sql": null }, { "role": "assistant", "content": "SELECT s.region, COUNT(DISTINCT s.server_id) AS server_count, AVG(gs.duration_sec...
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, firm_name charact...
[ { "role": "user", "content": "Show me the number of law firms founded per year.", "sql": null }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM founded_date) AS year, COUNT(*) AS firm_count FROM law_firms GROUP BY year;", "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 transportation.locations ( location_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Which locations lack a postal code? For each, display the name, type, city, and state_province.", "sql": null }, { "role": "assistant", "content": "SELECT name, type, city, state_province\nFROM transportation.locations\nWHERE postal_code IS NULL;", "sql": nu...
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 character varying(64) NOT NU...
[ { "role": "user", "content": "Can you list all the policy numbers and their group_numbers for policies that will expire within the next 90 days from today?", "sql": null }, { "role": "assistant", "content": "SELECT policy_number, group_number FROM healthcare.patient_insurance WHERE expiratio...
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": "Show all claims, including the claim ID, incident date, estimated loss, and the full name of the claim handler.", "sql": null }, { "role": "assistant", "content": "SELECT T1.claim_id, T1.incident_date, T1.estimated_loss, T2.first_name AS handler_first_name, T2.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.room_types ( room_type_id text, property_id text, type_name t...
[ { "role": "user", "content": "Show me all available services with a unit of 'Per Hour'.", "sql": null }, { "role": "assistant", "content": "SELECT service_name , description , price FROM hospitality_technology.services WHERE is_available = true AND unit = 'Per Hour'", "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 insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id cha...
[ { "role": "user", "content": "Show the document ID, claim ID, and file name for all documents with a MIME type starting with 'image/'.", "sql": null }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name FROM insurance.claim_documents WHERE mime_type LIKE 'image/%';", ...
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.conversations ( conversation_id text PRIMARY KEY, created_at timestamp,...
[ { "role": "user", "content": "List the names of group conversations and the usernames of participants who joined after '2023-01-01'.", "sql": null }, { "role": "assistant", "content": "SELECT T1.group_name, T3.username FROM social_media.conversations AS T1 JOIN social_media.participants AS 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 government_services.citizens ( citizen_id character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "Show each service's name along with the total number of appointments scheduled and the number of unique locations these appointments are scheduled at.", "sql": null }, { "role": "assistant", "content": "SELECT s.service_name, COUNT(a.application_id) AS appointme...
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": "List all conversation IDs with the total number of messages sent in each conversation.", "sql": null }, { "role": "assistant", "content": "SELECT conversation_id, COUNT(*) AS message_count\nFROM social_media.messages\nGROUP BY conversation_id;", "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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, -- unique identi...
[ { "role": "user", "content": "Show each insurance plan name along with the number of doctors whose phone number matches the plan's contact_phone.", "sql": null }, { "role": "assistant", "content": "SELECT p.plan_name, COUNT(d.doctor_id) AS matching_doctors\nFROM healthcare.insurance_plans p\...
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 NOT NULL DEFAULT gen_random_uu...
[ { "role": "user", "content": "I'd like to know how many sessions were hosted on each server, and the average duration of those sessions.", "sql": null }, { "role": "assistant", "content": "SELECT server_id, COUNT(session_id) AS session_count, AVG(duration_seconds) AS avg_duration\nFROM gamin...
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 users who have pending orders for cryptocurrency assets, along with the asset_id and order quantity.", "sql": null }, { "role": "assistant", "content": "SELECT u.user_id, u.email, o.asset_id, o.quantity FROM trading_platform.users u JOIN trading_platfor...
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 text, license_plate text, vin text, make text, ...
[ { "role": "user", "content": "Please provide the passenger_id, first_name, last_name, booking_id, and booking_time for all bookings where seat_number is 'A1'.", "sql": null }, { "role": "assistant", "content": "SELECT p.passenger_id, p.first_name, p.last_name, b.booking_id, b.booking_time\nF...
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 character varying(64) NOT NULL, plan_name chara...
[ { "role": "user", "content": "List the plan ID, plan name, and insurance provider for all plans whose plan type is 'EPO' and have a contact phone number specified.", "sql": null }, { "role": "assistant", "content": "SELECT plan_id, plan_name, insurance_provider FROM healthcare.insurance_plan...
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 trip, show the trip ID, scheduled departure, and the last name of the driver.", "sql": null }, { "role": "assistant", "content": "SELECT t.trip_id, t.scheduled_departure, d.last_name\nFROM transportation.trips t\nJOIN transportation.drivers d ON t.drive...
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 PRIMARY KEY, title text, developer_id uuid, p...
[ { "role": "user", "content": "Provide each developer_id, the number of games they have released, and the total items acquired across all their games.", "sql": null }, { "role": "assistant", "content": "SELECT g.developer_id,\n COUNT(g.game_id) AS game_count,\n SUM(pi.quantity) 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 transportation.routes ( route_id.text, route_number.text, description.text, origin_l...
[ { "role": "user", "content": "List all trips with their ID, vehicle ID, and driver ID.", "sql": null }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id FROM transportation.trips;", "sql": null }, { "role": "user", "content": "Can you also include the ...
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.staff ( staff_id character varying(64) NOT NULL, -- uniq...
[ { "role": "user", "content": "List all staff members along with their manager's full name.", "sql": null }, { "role": "assistant", "content": "SELECT s.staff_id, s.first_name, s.last_name, m.first_name AS manager_first_name, m.last_name AS manager_last_name\nFROM hospitality_technology.staff...
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": "Find the first name, last name, and contact email of citizens who have scheduled appointments in March 2024.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT T1.first_name, T1.last_name, T1.contact_email FROM government_services.citizens AS T1...
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.applications ( application_id.text, citizen_id.text, service_id....
[ { "role": "user", "content": "Show me the number of appointments scheduled at each location, along with the location name and city.", "sql": null }, { "role": "assistant", "content": "SELECT loc.location_name, loc.city, COUNT(appt.appointment_id) AS appointment_count\nFROM government_service...
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.claim_documents ( document_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Find the earliest uploaded document for each claim. Show the claim_id, document_id, file_name, and uploaded_at.", "sql": null }, { "role": "assistant", "content": "SELECT cd.claim_id, cd.document_id, cd.file_name, cd.uploaded_at\nFROM insurance.claim_documents 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": "Which wallets currently hold more than 200 units of any ERC1155 NFT, and what is the token ID and contract address for each such holding?", "sql": null }, { "role": "assistant", "content": "SELECT contract_address, token_id, wallet_address, amount FROM nft_holde...
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.text, property_id.text, room_number.text, roo...
[ { "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.", "sql": null }, { "role": "assistant", "content": "SELECT r1.property_id,\n r1.floor,\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 insurance.customers ( customer_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "List all insurance products that have not been updated in the past year. Include product_id, product_name, and updated_at, and order by updated_at ascending.", "sql": null }, { "role": "assistant", "content": "SELECT product_id, product_name, updated_at\nFROM in...
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.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, sp...
[ { "role": "user", "content": "I want to see a list of insurance plans along with the full names of all doctors whose hospital affiliation ID matches the plan ID. For each entry, include the plan name, insurance provider, doctor ID, and the doctor's first and last name.", "sql": null }, { "role":...
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 text PRIMARY KEY, national_id_number text,...
[ { "role": "user", "content": "Show the names of all services and the names of their corresponding agencies that are offered at accessible locations in 'Chicago'.", "sql": null }, { "role": "assistant", "content": "SELECT s.service_name, sl.agency_id \nFROM government_services.service_locatio...
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.text, license_plate.text, vin.text, make.text, ...
[ { "role": "user", "content": "Show me all maintenance logs for vehicles assigned to depots in 'Los Angeles'. For each log, list the log_id, vehicle_id, service_date, and depot name.", "sql": null }, { "role": "assistant", "content": "SELECT ml.log_id, ml.vehicle_id, ml.service_date, loc.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 financial_services.market_data ( data_point_id bigserial NOT NULL, security_id chara...
[ { "role": "user", "content": "I'd like a report showing for each sector the average close_price and maximum volume from market_data for the previous quarter.", "sql": null }, { "role": "assistant", "content": "SELECT s.sector, AVG(md.close_price) AS avg_close_price, MAX(md.volume) AS max_vol...
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 character varying(64) NOT NULL, -- uniq...
[ { "role": "user", "content": "List all pairs of employees who work in the same department but at different branches. For each pair, show the employee_id and branch_id for both members.", "sql": null }, { "role": "assistant", "content": "SELECT a.employee_id AS employee_id_a, a.branch_id AS b...
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, username character vary...
[ { "role": "user", "content": "How many posts has user 'U150' made so far?", "sql": null }, { "role": "assistant", "content": "SELECT COUNT(*) AS post_count\nFROM social_media.posts\nWHERE user_id = 'U150';", "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.invoices ( invoice_id text, invoice_number text, client_id text, case...
[ { "role": "user", "content": "List all invoices with status 'Paid' where the payment date is later than the due date, showing the invoice number, issue date, due date, payment date, total amount, and amount paid.", "sql": null }, { "role": "assistant", "content": "SELECT invoice_number, issu...
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": "Count the number of distinct patients enrolled in each insurance plan. Return plan_id and patient_count.", "sql": null }, { "role": "assistant", "content": "SELECT plan_id,\n COUNT(DISTINCT patient_id) AS patient_count\nFROM healthcare.patient_insurance\nG...
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": "Can you list medical records along with the full name of the patient and their age at the time the record was created? Include record ID, record date, patient full name, and age in years.", "sql": null }, { "role": "assistant", "content": "SELECT mr.record_id, m...