system
stringlengths
323
8.11k
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 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." }, { "role": "assistant", "content": "SELECT DISTINCT type\nFROM trading_platform.assets;" } ]
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, first_name text, last_name text, specialty text...
[ { "role": "user", "content": "For each medication manufacturer, show the total number of distinct generic names they produce." }, { "role": "assistant", "content": "SELECT manufacturer, COUNT(DISTINCT generic_name) AS distinct_generic_name_count FROM healthcare.medications WHERE generic_name IS ...
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.text, case_number.text, case_name.text, client_id.tex...
[ { "role": "user", "content": "Now, sort the results by the date opened, oldest first, and show only the top 10." }, { "role": "assistant", "content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Cri...
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.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for...
[ { "role": "user", "content": "List the token symbol, token name, and contract address for all tokens that have no recorded transfers in the token_transfers table." }, { "role": "assistant", "content": "SELECT T.token_symbol, T.token_name, T.contract_address FROM web3.tokens AS T LEFT JOIN token_...
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 the full names and dates of birth for all patients who do not have a phone number on record." }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE phone_number IS NULL OR TRIM(phone_number) = '';" } ...
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 PRIMARY KEY, license_plate text, vin text,...
[ { "role": "user", "content": "List all fuel refueling events with the refueled vehicle's make and model, the fuel type used, and the fueling location ID." }, { "role": "assistant", "content": "SELECT fl.fuel_log_id, fl.log_timestamp, v.make, v.model, fl.fuel_type, fl.quantity, fl.unit, fl.total_...
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 history of incidents or accidents that occurred on platform 5 at station GHI?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about the history of incidents or accidents on platform 5 at station GHI. My data is limited 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.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for...
[ { "role": "user", "content": "List the token symbol and name for all tokens whose associated contract address has emitted at least one event. Also include the contract address." }, { "role": "assistant", "content": "SELECT T.token_symbol, T.token_name, T.contract_address FROM web3.tokens AS T JO...
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 maintenance costs for a specific aircraft model like the Airbus A320?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to data regarding maintenance costs for specific aircraft models such as the Airbus A320. The information 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 trading_platform.wallets ( wallet_id character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "For each asset, calculate the total quantity and average price of orders that have status 'filled'." }, { "role": "assistant", "content": "SELECT o.asset_id,\n SUM(o.quantity) AS total_quantity,\n AVG(o.price) AS average_price\nFROM trading_platform....
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 the customer_id and pairs of payment_ids for any customers who have overlapping payment periods." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p1.payment_id AS payment1_id,\n p2.payment_id AS payment2_id\nFROM insurance.premium_pay...
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 character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "Show each maintenance log with the vehicle ID, make, model, service date, and the cost, including the city where the maintenance was performed." }, { "role": "assistant", "content": "SELECT ml.log_id, ml.vehicle_id, v.make, v.model, ml.service_date, ml.cost, l.city ...
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": "For each game, which server has hosted the most sessions?" }, { "role": "assistant", "content": "SELECT game_id, server_id, COUNT(*) AS session_count FROM gaming_technology.game_sessions GROUP BY game_id, server_id;" }, { "role": "user", "content": "I wa...
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": "Show the total number of game sessions played on each server that is currently 'online'. Include the server name, region, and the count of sessions." }, { "role": "assistant", "content": "SELECT s.server_name, s.region, COUNT(gs.session_id) AS total_sessions FROM ga...
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.trips ( trip_id character varying(64) NOT NULL, -- unique identi...
[ { "role": "user", "content": "List all trips that were completed and experienced a significant delay in actual arrival compared to the scheduled arrival (more than 45 minutes)." }, { "role": "assistant", "content": "SELECT\n trip_id,\n vehicle_id,\n driver_id,\n scheduled_arrival,\n actual_...
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 character varying(64) NOT NULL, invoice_number ...
[ { "role": "user", "content": "What is the average number of days by which paid invoices were paid late? Calculate the average of (payment_date - due_date) for invoices with status 'Paid'." }, { "role": "assistant", "content": "SELECT AVG((payment_date::date - due_date)) AS average_late_days\nFRO...
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?" }, { "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 as train ID, model...
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 text, token_id text, from_address text, to_addres...
[ { "role": "user", "content": "For each transaction, list the total value transferred and the number of different addresses involved (either as sender or receiver)." }, { "role": "assistant", "content": "SELECT transaction_id, SUM(value) AS total_value_transferred, COUNT(DISTINCT addr) AS num_add...
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.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for...
[ { "role": "user", "content": "Show all token symbols along with the names of any other tokens on the same contract address." }, { "role": "assistant", "content": "SELECT t1.token_symbol, t2.token_name AS other_token_name, t1.contract_address\nFROM web3.tokens t1\nJOIN web3.tokens t2\n ON t1.con...
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 PRIMARY KEY, patient_id text, doctor_i...
[ { "role": "user", "content": "How many appointments are scheduled at each location?" }, { "role": "assistant", "content": "SELECT location_id, COUNT(*) AS scheduled_count FROM healthcare.appointments WHERE status = 'scheduled' GROUP BY location_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 insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identif...
[ { "role": "user", "content": "Find the total amount paid for all premium payments made in the last 30 days." }, { "role": "assistant", "content": "SELECT SUM(amount_paid) FROM insurance.premium_payments WHERE payment_date >= CURRENT_DATE - INTERVAL '30 day';" } ]
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.likes ( like_id character varying(64) NOT NULL, -- unique identifie...
[ { "role": "user", "content": "Which users have received both a comment notification and a like notification? List the recipient_user_id and the total number of such users." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT recipient_user_id) AS user_count\nFROM (\n SELECT recipient_us...
You are an 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, employee_id.text, first_name.text, last_nam...
[ { "role": "user", "content": "List each driver along with the driver_id of the driver who was hired immediately after them." }, { "role": "assistant", "content": "SELECT d1.driver_id AS current_driver_id, d2.driver_id AS next_driver_id FROM transportation.drivers d1 LEFT JOIN transportation.driv...
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 maintenance schedule for the train car with car_id 'CAR456'?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about the maintenance schedule for train cars as it is not included in the data available in the train_cars tab...
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": "How many DApps have names that start with the letter 'A'?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS dapp_count\nFROM trading_platform.dapps\nWHERE name LIKE '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 blockchain.wallets ( wallet_id text, user_id text, address_id text, private_key text...
[ { "role": "user", "content": "Show me the top 5 users with the most wallet addresses, along with the count of their wallets." }, { "role": "assistant", "content": "SELECT user_id, COUNT(wallet_id) AS wallet_count FROM blockchain.wallets WHERE user_id IS NOT NULL GROUP BY user_id ORDER BY wallet_...
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 cex_token_balance (", "snapshot_time character varying(32) NOT NULL, -- the ...
[ { "role": "user", "content": "Find all tokens on the 'BSC' chain in the latest snapshot where the individual holding `usd_value` is greater than $1,000,000. Show their symbol, exchange, balance, and USD value." }, { "role": "assistant", "content": "WITH latest_snapshot AS (\n SELECT max(snapsho...
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": "List all unique peer ports that have been used at least once in the system." }, { "role": "assistant", "content": "SELECT DISTINCT port FROM trading_platform.peers ORDER BY port ASC;" } ]
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.service_locations ( location_id text, agency_id text, location_n...
[ { "role": "user", "content": "For each city and state, show the number of service locations available along with their accessibility status." }, { "role": "assistant", "content": "SELECT city, state, is_accessible, COUNT(*) AS location_count FROM government_services.service_locations GROUP BY ci...
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.likes ( like_id character varying(64) NOT NULL, -- unique identifie...
[ { "role": "user", "content": "Count the total number of likes on posts versus likes on comments across the entire platform." }, { "role": "assistant", "content": "SELECT CASE WHEN post_id IS NOT NULL THEN 'post' ELSE 'comment' END AS like_target, COUNT(*) AS total_likes FROM social_media.likes 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 legal_services.documents ( document_id text, case_id text, document_name text, docum...
[ { "role": "user", "content": "Show all pairs of 'Evidence' documents within the same case, listing their document names, version numbers, and the shared case_id." }, { "role": "assistant", "content": "SELECT d1.case_id,\n d1.document_name AS doc1_name,\n d1.version AS doc1_versi...
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": "Count the number of trips for each route type." }, { "role": "assistant", "content": "SELECT R.type, COUNT(T.trip_id) FROM transportation.trips AS T JOIN transportation.routes AS R ON T.route_id = R.route_id GROUP BY R.type;" } ]
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 project_fundraising_record ( id text, project_id text, project_name text, rounds_nam...
[ { "role": "user", "content": "How many fundraising rounds did each project complete?" }, { "role": "assistant", "content": "SELECT project_name, COUNT(*) AS round_count FROM project_fundraising_record GROUP BY project_name;" } ]
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 training programs or certifications completed by a staff member with the role of Platform Supervisor?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to information about the training programs or certifications completed by sta...
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": "Show me all patients who have non-primary insurance plans with expiration dates within the next 60 days, along with their policy numbers and subscriber names." }, { "role": "assistant", "content": "SELECT patient_id, policy_number, subscriber_name FROM healthcare.pa...
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": "Provide every combination of medication name and insurance plan name." }, { "role": "assistant", "content": "SELECT m.medication_name, p.plan_name\nFROM healthcare.medications AS m\nCROSS JOIN healthcare.insurance_plans AS 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 web3.events ( event_id.text, contract_id.text, event_name.text, data.text, emitted_a...
[ { "role": "user", "content": "Find all token transfers where the value is greater than 5000, including the token_id and transaction details like from_address and gas_used, sorted by value in descending order." }, { "role": "assistant", "content": "SELECT tt.token_id, tt.value, t.from_address, 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birt...
[ { "role": "user", "content": "List the plan_id, plan_name, and plan_type for all insurance plans where the insurance_provider is 'Humana'." }, { "role": "assistant", "content": "SELECT\n plan_id,\n plan_name,\n plan_type\nFROM healthcare.insurance_plans\nWHERE\n insurance_provider = 'Humana'...
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, national_i...
[ { "role": "user", "content": "List all citizens who submitted an application within 24 hours of registering. Show the application_id, citizen's full name, registration_date, and submitted_at timestamp." }, { "role": "assistant", "content": "SELECT\na.application_id,\n(c.first_name || ' ' || c.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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifi...
[ { "role": "user", "content": "List usernames and bio information for users who have set a non-empty bio in their profile." }, { "role": "assistant", "content": "SELECT username, bio\nFROM social_media.users\nWHERE bio IS NOT NULL AND TRIM(bio) <> '';" } ]
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": "Calculate the average total amount for invoices issued in each calendar year." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM issue_date) AS issue_year, AVG(total_amount) AS average_total_amount FROM legal_services.invoices GROUP BY EXTRACT(YEAR 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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising reco...
[ { "role": "user", "content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 6 months, along with their narrative information if available." }, { "role": "assistant", "content": "SELECT pfr.project_name, pfr.rounds_name, pfr.valuation, pfr.investment_date, ...
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 text PRIMARY KEY, token_id text, from_address tex...
[ { "role": "user", "content": "Find all pairs of token transfers where one transfer's sender and recipient are swapped with another transfer's sender and recipient, showing both transfer IDs." }, { "role": "assistant", "content": "SELECT t1.from_address AS sender,\n t1.to_address AS recip...
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.medical_records ( record_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "I want to list all insurance plans along with the number of medical records that have a record_date in 2024. Display plan_id, plan_name, and the total medical records." }, { "role": "assistant", "content": "SELECT ip.plan_id, ip.plan_name, COUNT(mr.record_id) AS tot...
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 current number of passengers at station with ID 'ST123' right now?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the current number of passengers at a station. The data I have access to only includes static details ...
You are an 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": "List games that have servers deployed in more than one geographical region. Show the game title and the count of regions." }, { "role": "assistant", "content": "SELECT g.title, count(DISTINCT s.region) AS region_count FROM games AS g JOIN servers AS s ON g.game_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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text...
[ { "role": "user", "content": "Find all prescriptions for patients who have at least one appointment scheduled in the future. Show the prescription ID, patient ID, medication name, and the earliest future appointment time for that patient." }, { "role": "assistant", "content": "SELECT pr.prescrip...
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": "How many documents are there for each document_type? Show document_type and count ordered by the count in descending order." }, { "role": "assistant", "content": "SELECT document_type,\n COUNT(*) AS count\nFROM legal_services.documents\nGROUP BY document_type\...
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 DApps along with the number of metadata entries linked to each, even if the DApp has no linked metadata." }, { "role": "assistant", "content": "SELECT d.name, d.url, COUNT(m.metadata_id) AS metadata_count\nFROM trading_platform.dapps d\nLEFT JOIN trading_pl...
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, ...
[ { "role": "user", "content": "Show the first name, last name, and position of all staff members who are not currently active." }, { "role": "assistant", "content": "SELECT first_name , last_name , position FROM hospitality_technology.staff WHERE is_active = false" } ]