Dataset Viewer
Auto-converted to Parquet Duplicate
system
stringlengths
336
6.46k
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 social_media.users ( user_id character varying(64) NOT NULL, username character vary...
[ { "role": "user", "content": "I need a list of all group chat names with every username." }, { "role": "assistant", "content": "SELECT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.conversations c ON 1=1\nWHERE c.is_group_chat = true;" }, { "role": "user", "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 legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.tex...
[ { "role": "user", "content": "List all cases that have an invoice issued in July 2024, showing the case name, case number, invoice number, and issue date." }, { "role": "assistant", "content": "SELECT T1.case_name, T1.case_number, T2.invoice_number, T2.issue_date FROM legal_services.cases 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 healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id ch...
[ { "role": "user", "content": "For each patient, find their latest medical record and show patient_id, latest_record_id, and record_date." }, { "role": "assistant", "content": "SELECT a.patient_id,\n a.record_id AS latest_record_id,\n a.record_date\nFROM healthcare.medical_records a\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.users ( user_id character varying(64) NOT NULL, -- unique iden...
[ { "role": "user", "content": "Show me all users whose email address contains the word 'test', along with their user IDs and the date they registered." }, { "role": "assistant", "content": "SELECT user_id, username, email, created_at FROM trading_platform.users WHERE email ILIKE '%test%';" }, ...
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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id te...
[ { "role": "user", "content": "List all beneficiaries who have a relationship of 'Parent' and a percentage_share less than 25%. Show their beneficiary_id, first_name, last_name, relationship, and percentage_share." }, { "role": "assistant", "content": "SELECT beneficiary_id, first_name, 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name charac...
[ { "role": "user", "content": "List documents uploaded for cases of type 'Intellectual Property', showing the document name, upload timestamp, and the case number." }, { "role": "assistant", "content": "SELECT T1.document_name, T1.upload_timestamp, T2.case_number FROM documents AS T1 JOIN cases 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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, p...
[ { "role": "user", "content": "For each player, show their username and the total number of achievements they have unlocked in games where they also own at least one item. Only include players who have unlocked at least one achievement." }, { "role": "assistant", "content": "SELECT p.username, 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 transportation.bookings ( booking_id character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "Show me the total number of bookings and total fare collected per trip. Only include trips that have collected more than 500 in total fare." }, { "role": "assistant", "content": "SELECT trip_id, COUNT(*) AS booking_count, SUM(fare) AS total_fare\nFROM transportation...
You are an 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.text, chain.text, address.text, exchange.text, tok...
[ { "role": "user", "content": "How many unique tokens are recorded for each chain in the latest snapshot in cex_token_balance?" }, { "role": "assistant", "content": "WITH latest_snapshot AS (\n SELECT MAX(snapshot_time) AS max_time FROM cex_token_balance\n)\nSELECT \n chain, \n COUNT(DISTINCT ...
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.medications ( medication_id text, medication_name text, generic_name text...
[ { "role": "user", "content": "I need to find all pairs of medications that share the same manufacturer. For each pair, show the first medication's ID and name, the second medication's ID and name, and the manufacturer." }, { "role": "assistant", "content": "SELECT m1.medication_id AS med1_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 blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, time...
[ { "role": "user", "content": "Find all smart contracts where the contract code contains the keyword 'proxy'." }, { "role": "assistant", "content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE code LIKE '%proxy%';" }, { "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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name characte...
[ { "role": "user", "content": "Which patients have a primary insurance policy and are subscribed to a plan provided by 'Cigna'? List patient ID, full name, policy number, plan ID, and insurance provider." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.pol...
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.insurance_products ( product_id text PRIMARY KEY, product_name text, produ...
[ { "role": "user", "content": "List all insurance products along with their product types and the date they were last updated, but only include products where the base premium is greater than 2000." }, { "role": "assistant", "content": "SELECT product_id, product_name, product_type, updated_at\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 financial_services.customers ( customer_id text, first_name text, last_name text, da...
[ { "role": "user", "content": "List all employees hired in 2023 along with their job title and email." }, { "role": "assistant", "content": "SELECT employee_id, first_name, last_name, job_title, email\nFROM financial_services.employees\nWHERE EXTRACT(YEAR FROM hire_date) = 2023;" }, { "ro...
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.text, record_id.text, patient_id.text, doctor_id...
[ { "role": "user", "content": "Show all insurance plans where the plan name includes the word 'Care'." }, { "role": "assistant", "content": "SELECT plan_id, plan_name, insurance_provider, plan_type\nFROM healthcare.insurance_plans\nWHERE plan_name ILIKE '%Care%';" } ]
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": "Calculate the total amount billed for each client, showing their first name, last name, and the total amount." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, SUM(i.total_amount) FROM legal_services.clients c JOIN legal_services.invoices i 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 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." }, { "role": "assistant", "content": "SELECT\n wallet_id AS current_wallet_id,\n LAG(...
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": "Which token on the Ethereum chain had the highest realized ratio last quarter? Show the symbol, realized ratio, and ROI." }, { "role": "assistant", "content": "SELECT token_symbol, realized_ratio, roi FROM smart_money_token_performance WHERE chain = 'Ethereum' AND 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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_h...
[ { "role": "user", "content": "Show the usernames of users who have used any hashtag in their posts, along with the tag name." }, { "role": "assistant", "content": "SELECT DISTINCT T1.username, T4.tag_name FROM social_media.users AS T1 JOIN posts AS T2 ON T1.user_id = T2.user_id JOIN post_hashtag...
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": "List all ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses." }, { "role": "assistant", "content": "SELECT t.name, t.symbol, t.address FROM token_prices_latest t WHERE t.price BETWEEN 1 AND 10;" }, { "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 financial_services.transactions ( transaction_id text, account_id text, related_acco...
[ { "role": "user", "content": "Show the total incoming and outgoing amounts for each account_id, along with the number of transactions for each type (incoming and outgoing). An incoming transaction is when the account_id appears as related_account_id." }, { "role": "assistant", "content": "SELECT...
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": "Find all documents that are larger than 5MB. Show the document ID, claim ID, file name, and file size in bytes." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name, file_size_bytes\nFROM insurance.claim_documents\nWHERE file_size_bytes > 5...
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 vehicles that are due for their next service before the end of this month, along with their last service date and type." }, { "role": "assistant", "content": "SELECT v.vehicle_id, v.make, v.model, s.service_date, s.service_type FROM transportation.vehicl...
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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, ...
[ { "role": "user", "content": "Find all vehicles that have at least one fuel log and at least one maintenance log. For each vehicle, show vehicle_id, make, model, the date of its most recent maintenance, and the timestamp of its earliest fuel log." }, { "role": "assistant", "content": "SELECT v.v...
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.text, record_id.text, patient_id.text, doctor_id...
[ { "role": "user", "content": "Show me each patient and doctor pair that have both an active chronic diagnosis and at least one prescription recorded in the same medical record. Include patient_id, doctor_id, diagnosis_date, prescription_date, and medication_id." }, { "role": "assistant", "conten...
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 average delay time for trains departing from platform 4 at station LMN during the past year?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on train delay times as this data is not stored in the platforms table. The 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 government_services.service_locations ( location_id text PRIMARY KEY, agency_id text...
[ { "role": "user", "content": "For each service location, find the nearest accessible service location. Show the location_id, location_name, nearest_location_id, and the distance." }, { "role": "assistant", "content": "SELECT l.location_id,\n l.location_name,\n nearest.location_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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, ...
[ { "role": "user", "content": "Show the number of staff members for each property, along with the property name." }, { "role": "assistant", "content": "SELECT p.property_name, COUNT(s.staff_id) AS staff_count\nFROM hospitality_technology.properties p\nJOIN hospitality_technology.staff s ON p.prop...
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": "For each notification sent through the 'SMS' channel, list the notification ID, message subject, and the full name of the citizen who received it." }, { "role": "assistant", "content": "SELECT n.notification_id, n.message_subject, 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 social_media.messages ( message_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "List the last 20 messages that have a media_url, showing message_id, sender_user_id, media_type, and sent_at, ordered by sent_at descending." }, { "role": "assistant", "content": "SELECT message_id,\n sender_user_id,\n media_type,\n sent_at\nFROM 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 social_media.hashtags ( hashtag_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "How many hashtags are currently stored in the hashtags table?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS total_hashtags\nFROM social_media.hashtags;" } ]
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_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexp...
[ { "role": "user", "content": "List tokens on 'Arbitrum' with liquidity over 5000000." }, { "role": "assistant", "content": "SELECT * FROM token_dexpool_info WHERE chain = 'Arbitrum' AND liquidity > 5000000;" }, { "role": "user", "content": "Filter those tokens to only include ones wi...
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 character varying(64) NOT NULL, -- u...
[ { "role": "user", "content": "List the full names of all employees who are currently employed (i.e., have no termination date)." }, { "role": "assistant", "content": "SELECT first_name || ' ' || last_name AS full_name FROM government_services.employees WHERE termination_date IS 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch...
[ { "role": "user", "content": "Show the total transfer volume and number of transfers for each Avalanche token in the past 7 days, including token tick and its creator." }, { "role": "assistant", "content": "SELECT ta.tick, ti.creator, SUM(ta.amt) AS total_volume, COUNT(*) AS transfer_count\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": "List the ticker symbol and security name for all securities that had a volume greater than 100000 on '2023-10-27'." }, { "role": "assistant", "content": "SELECT T2.ticker_symbol, T2.security_name FROM financial_services.market_data AS T1 JOIN financial_services.secu...
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": "Which projects raised funds in January 2022?" }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, investment_date FROM project_fundraising_record WHERE investment_date >= '2022-01-01' AND investment_date < '2022-02-01';" }, ...
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 patients who have more than two primary active insurance policies, showing their patient ID and the count of such policies. Also, list the plan names for these policies." }, { "role": "assistant", "content": "SELECT pi.patient_id, COUNT(*) AS active_primary...
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." }, { "role": "assistant", "content": "SELECT plan_id,\n COUNT(DISTINCT patient_id) AS patient_count\nFROM healthcare.patient_insurance\nGROUP BY plan_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 PRIMARY KEY, first_name text, last_name text, sp...
[ { "role": "user", "content": "List the subscriber names from patient insurance entries where the group number is not provided (is null)." }, { "role": "assistant", "content": "SELECT subscriber_name FROM healthcare.patient_insurance WHERE group_number IS 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 character varying(64) NOT NULL, first_name characte...
[ { "role": "user", "content": "Show the name of each insurance plan and the total number of patients whose primary insurance policy for that plan is currently active. Include only plans that have at least one such patient." }, { "role": "assistant", "content": "SELECT T1.plan_name, COUNT(DISTINCT...
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 // db.createCollection('stations') // Optional: Add unique index: db.stations.createIndex({ stati...
[ { "role": "user", "content": "Can you help me count the total number of active staff members in the database?" }, { "role": "assistant", "content": "db.staff.countDocuments({ is_active: true });" } ]
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.text, address.text, abi.text, bytecode.text, deployer_a...
[ { "role": "user", "content": "Find the contract ID, address, and deployer address for all contracts that have not emitted any events." }, { "role": "assistant", "content": "SELECT c.contract_id, c.address, c.deployer_address FROM web3.contracts AS c LEFT JOIN web3.events AS e ON c.contract_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 transportation.trips ( trip_id character varying(64) NOT NULL, -- unique identi...
[ { "role": "user", "content": "Retrieve trip_id and passenger full names for all trips where the passenger record was created before the scheduled departure." }, { "role": "assistant", "content": "SELECT t.trip_id, p.first_name || ' ' || p.last_name AS passenger_name\nFROM transportation.trips 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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_h...
[ { "role": "user", "content": "Please provide each follow relationship, including the follower's username, the followed user's username, and the follow creation timestamp." }, { "role": "assistant", "content": "SELECT\n u1.username AS follower_username,\n u2.username AS following_username,\n f...
You are an 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": "For hashtag ID 'H789', get each post ID and the number of distinct comments that have been made on those posts." }, { "role": "assistant", "content": "SELECT ph.post_id,\n COUNT(DISTINCT c.comment_id) AS comment_count\nFROM social_media.post_hashtags ph\nJOIN ...
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": "Calculate the average 24-hour trading volume for all tokens listed in DEX pools on the 'BSC' chain." }, { "role": "assistant", "content": "SELECT AVG(volume_24h) FROM token_dexpool_info WHERE chain = 'BSC'" } ]
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 pairs of games that share the same publisher but belong to different genres, showing both titles and genres." }, { "role": "assistant", "content": "SELECT g1.game_id AS game1_id,\n g1.title AS title1,\n g1.genre AS genre1,\n g2.game_id AS game...
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": "List all patients who have insurance plans with group numbers, showing their patient IDs and the count of such plans per patient." }, { "role": "assistant", "content": "SELECT patient_id, COUNT(*) AS plan_count FROM healthcare.patient_insurance WHERE group_number 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 social_media.posts ( post_id character varying(64) NOT NULL, user_id character varyi...
[ { "role": "user", "content": "Find posts that have been liked by users the author of the post is following. List the post_id and the user_id of the post author." }, { "role": "assistant", "content": "SELECT p.post_id, p.user_id AS post_author_user_id FROM social_media.posts AS p JOIN social_medi...
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": "Summarize the total balance and average interest rate for each account type." }, { "role": "assistant", "content": "SELECT account_type, SUM(balance) AS total_balance, AVG(interest_rate) AS average_interest_rate FROM financial_services.accounts GROUP BY account_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 web3.users ( user_id character varying(64) NOT NULL, username character varying(128)...
[ { "role": "user", "content": "How many users registered in each month?" }, { "role": "assistant", "content": "SELECT date_trunc('month', created_at) AS month,\n COUNT(*) AS registrations\nFROM web3.users\nGROUP BY month\nORDER BY month;" }, { "role": "user", "content": "Actuall...
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 PRIMARY KEY, customer_id text, account...
[ { "role": "user", "content": "Can you provide a list of all trades in the past 90 days, including the security_id, account_id, trade_type, quantity, total_amount, and the current balance of the involved account?" }, { "role": "assistant", "content": "SELECT t.trade_id, t.security_id, t.account_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 government_services.employees ( employee_id character varying(64) NOT NULL, -- u...
[ { "role": "user", "content": "List the first name, last name, and job title of each employee, along with the job title of their manager." }, { "role": "assistant", "content": "SELECT e.first_name AS employee_first_name, e.last_name AS employee_last_name, e.job_title AS employee_job_title, m.job_...
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 average speed of train number T9876 during its last journey?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the average speed of train number T9876 during its last journey. The data in the trains table does not inclu...
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 text, route_id text, vehicle_id text, driver_id text,...
[ { "role": "user", "content": "List all trips with their trip_id, vehicle_id, and the corresponding origin_location_id and destination_location_id, but only where the origin and destination are not the same." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, origin_location_id, de...
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 PRIMARY KEY, citizen_id text,...
[ { "role": "user", "content": "List the application ID, submitted date, and assigned employee ID for all applications that are currently in 'Processing' status and were submitted before January 1st, 2024." }, { "role": "assistant", "content": "SELECT application_id, submitted_at, assigned_employe...
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": "Show the content of comments and the content of the posts they belong to, for comments made by users whose location is 'New York'. Also include the username of the commenter." }, { "role": "assistant", "content": "SELECT c.content AS comment_content, p.content AS 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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique ...
[ { "role": "user", "content": "For each route, show its route number, distance in kilometers, and the total number of trips that have used that route." }, { "role": "assistant", "content": "SELECT r.route_number, r.distance_km, COUNT(t.trip_id) AS trip_count\nFROM transportation.routes r\nLEFT 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 financial_services.customers ( customer_id text, first_name text, last_name text, da...
[ { "role": "user", "content": "Show me the total number of customers and their average age grouped by city." }, { "role": "assistant", "content": "SELECT city, COUNT(customer_id) AS total_customers, AVG(EXTRACT(YEAR FROM NOW()) - EXTRACT(YEAR FROM date_of_birth)) AS average_age FROM financial_ser...
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": "Find all pairs of citizens who share the same last name but have different dates of birth. Display both full names, the shared last name, and each date of birth." }, { "role": "assistant", "content": "SELECT\n c1.first_name || ' ' || c1.last_name AS citizen1_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 legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique id...
[ { "role": "user", "content": "List the first name, last name, email, and the name of the law firm for all lawyers." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , T1.email , T2.firm_name FROM legal_services.lawyers AS T1 JOIN law_firms AS T2 ON T1.firm_id = T2.f...
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, first_name charact...
[ { "role": "user", "content": "Show me all customers who have purchased policies for insurance products of type 'health', including their full name, policy number, and the insurance product's name." }, { "role": "assistant", "content": "SELECT c.customer_id, c.first_name, c.last_name, p.policy_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 hospitality_technology.rooms ( room_id text, property_id text, room_number text, roo...
[ { "role": "user", "content": "Show me all rooms on floor 4 or above together with their room number, features, and current status." }, { "role": "assistant", "content": "SELECT room_id, room_number, features, status\nFROM hospitality_technology.rooms\nWHERE floor >= 4;" }, { "role": "use...
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 Use Hashes. Key pattern: 'inv:<inventory_record_id>'. Example: HSET inv:INVREC500 component_id "c...
[ { "role": "user", "content": "Can you help me retrieve the inventory details for a specific component ID, including the quantity and warehouse location?" }, { "role": "assistant", "content": "HGETALL inv:<inventory_record_id>" }, { "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 social_media.users ( user_id.text, username.text, email.text, password_hash.text, fu...
[ { "role": "user", "content": "Get the five most recent public posts that have media_type = 'video', showing post_id, created_at, and the author's username." }, { "role": "assistant", "content": "SELECT\n p.post_id,\n p.created_at,\n u.username\nFROM social_media.posts p\nJOIN social_media.use...
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 PRIMARY KEY, property_id text, reser...
[ { "role": "user", "content": "Find all review comments that have a staff response, showing the comment and the staff response date." }, { "role": "assistant", "content": "SELECT comment, response_date FROM reviews WHERE response_date IS NOT NULL;" }, { "role": "user", "content": "Now...
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.transactions ( transaction_id.text, account_id.text, related_acco...
[ { "role": "user", "content": "Show me the number of market data points and average adjusted close price per source." }, { "role": "assistant", "content": "SELECT source, COUNT(*) AS data_point_count, AVG(adjusted_close_price) AS avg_adjusted_close_price\nFROM financial_services.market_data\nGROU...
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, property_id text, guest_i...
[ { "role": "user", "content": "List reservations, including the reservation ID, check-in date, check-out date, property name, room type name, and room type base rate, for reservations with 3 or more adults." }, { "role": "assistant", "content": "SELECT T1.reservation_id, T1.check_in_date, T1.chec...
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": "List the names of services available at service locations that are accessible and located in the state of 'California'." }, { "role": "assistant", "content": "SELECT T1.service_name, T2.location_name FROM government_services.services AS T1 JOIN government_services.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.patients ( patient_id character varying(64) NOT NULL, first_name characte...
[ { "role": "user", "content": "List the license number and specialty for all doctors who have a phone number on record." }, { "role": "assistant", "content": "SELECT license_number, specialty FROM healthcare.doctors WHERE phone_number IS NOT 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.services ( service_id text, agency_id text, service_name text, d...
[ { "role": "user", "content": "List all pairs of active services in the same category where one service’s standard fee is higher than the other’s. Display the category, the higher-fee service name with its fee, and the lower-fee service name with its fee." }, { "role": "assistant", "content": "SE...
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": "Retrieve the top 5 players by the number of distinct achievements unlocked. Show player_id and distinct_unlocks." }, { "role": "assistant", "content": "SELECT p.player_id, COUNT(DISTINCT pa.achievement_id) AS distinct_unlocks\nFROM gaming_technology.players p\nJOIN ...
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": "Show the number of users registered each month for 2024." }, { "role": "assistant", "content": "SELECT\n date_trunc('month', created_at) AS month,\n COUNT(*) AS user_count\nFROM trading_platform.users\nWHERE created_at >= '2024-01-01'\n AND created_at < '2025-01-...
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.text, customer_id.text, product_id.text, agent_id.tex...
[ { "role": "user", "content": "Show all policy numbers with their corresponding payment_id and amount_paid for payments made on or after January 1st, 2024." }, { "role": "assistant", "content": "SELECT p.policy_number, pp.payment_id, pp.amount_paid\nFROM insurance.premium_payments pp\nJOIN insura...
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 content of all comments that have received at least one like." }, { "role": "assistant", "content": "SELECT DISTINCT T1.content FROM social_media.comments AS T1 JOIN social_media.likes AS T2 ON T1.comment_id = T2.comment_id;" }, { "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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number...
[ { "role": "user", "content": "Show me the subjects and start times of all appointments along with the document names of any documents uploaded for the associated case." }, { "role": "assistant", "content": "SELECT a.subject, a.start_time, d.document_name\nFROM legal_services.appointments a\nJOIN...
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": "Can you show me the total number of sessions and the average score for each server and each game combination?" }, { "role": "assistant", "content": "SELECT server_id, game_id, COUNT(*) AS total_sessions, AVG(score) AS average_score FROM gaming_technology.game_sessio...
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, chain character va...
[ { "role": "user", "content": "Show me the top 5 tokens by USD value held on the Binance Smart Chain, along with their average price and total balance." }, { "role": "assistant", "content": "SELECT token_symbol, AVG(price) as average_price, SUM(balance) as total_balance, SUM(usd_value) as total_u...
You are an 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 PRIMARY KEY, invoice_number text UNIQUE, c...
[ { "role": "user", "content": "Compute the total invoiced amount and average payment delay (in days) by status for invoices issued between 2024-01-01 and 2024-06-30." }, { "role": "assistant", "content": "SELECT status,\n SUM(total_amount) AS total_invoiced,\n AVG(EXTRACT(day FROM (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 // Use Hashes for ticket details. Key format: ticket:<ticket_id> // HSET ticket:tkt_1a2b ticket_i...
[ { "role": "user", "content": "特定のプラットフォームID 'plat_123' に関連するメンテナンス記録を取得するのを手伝っていただけますか?また、記録のステータスも含めてください。" }, { "role": "assistant", "content": "SMEMBERS platform:plat_123:maintenance\nHGETALL maintenance_record:<record_id>" }, { "role": "user", "content": "ステータスが 'Completed' の記録だけ...
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 PRIMARY KEY, first_name text, last_name text, ...
[ { "role": "user", "content": "Show me all patients who have received at least two different medications prescribed by doctors working at the same hospital. Include the patient full name, the medication names, and the shared hospital_affiliation_id." }, { "role": "assistant", "content": "SELECT 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 legal_services.clients ( client_id.text, first_name.text, last_name.text, company_na...
[ { "role": "user", "content": "Show the subject and start time for all appointments that are related to a case that also has an invoice. Include the case number and the invoice number." }, { "role": "assistant", "content": "SELECT T1.subject, T1.start_time, T2.case_number, T3.invoice_number 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 social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, crea...
[ { "role": "user", "content": "Show the total number of likes made by each user, including the user_id and their like count." }, { "role": "assistant", "content": "SELECT user_id, COUNT(*) AS like_count FROM social_media.likes GROUP BY user_id;" }, { "role": "user", "content": "Only 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 social_media.users ( user_id character varying(64) NOT NULL, username character vary...
[ { "role": "user", "content": "List all comment IDs and their content for comments made by users who have 'dark' as their theme." }, { "role": "assistant", "content": "SELECT c.comment_id, c.content\nFROM social_media.comments c\nJOIN social_media.user_settings s ON c.user_id = s.user_id\nWHERE 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.medical_records ( record_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Find all medical records associated with an appointment, and show the record_id, appointment_id, and the record_date." }, { "role": "assistant", "content": "SELECT record_id, appointment_id, record_date\nFROM healthcare.medical_records\nWHERE appointment_id IS NOT 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 hospitality_technology.rooms ( room_id character varying(64) NOT NULL, -- uniqu...
[ { "role": "user", "content": "Show the full names and emails of staff members who have delivered at least one service order." }, { "role": "assistant", "content": "SELECT DISTINCT s.first_name, s.last_name, s.work_email\nFROM hospitality_technology.staff s\nJOIN hospitality_technology.service_or...
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": "List all insurance plans along with their provider, plan type, and the contact phone number. Also, for each plan, show how many doctors have their hospital affiliation ID matching the plan ID." }, { "role": "assistant", "content": "SELECT ip.plan_id, ip.plan_name, i...
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
4