system
stringlengths
288
8.23k
conversations
listlengths
2
8
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "List the first name and last name of the driver and the license plate of the vehicle used for each trip." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , T3.license_plate FROM transportation.drivers AS T1 JOIN transportation.trips AS T2 O...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d...
[ { "role": "user", "content": "For each claim, list the incident date, the policy number, and the number of beneficiaries associated with that policy." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, p.policy_number, COUNT(pb.beneficiary_id) AS beneficiary_count\nFROM in...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "How many players are there for each status in the players table?" }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS player_count\nFROM gaming_technology.players\nGROUP BY status;" }, { "role": "user", "content": "Exclude any rows where sta...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.locations ( location_id character varying(64) NOT NULL, -- unique identifier for the location n...
[ { "role": "user", "content": "Which locations lack a postal code? For each, display the name, type, city, and state_province." }, { "role": "assistant", "content": "SELECT name, type, city, state_province\nFROM transportation.locations\nWHERE postal_code IS NULL;" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number text, firm_id text, email text, ph...
[ { "role": "user", "content": "Retrieve document names and the uploader's full name for all documents with version greater than 1." }, { "role": "assistant", "content": "SELECT d.document_name,\n l.first_name || ' ' || l.last_name AS uploader\nFROM legal_services.documents d\nJOIN legal_ser...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address character vary...
[ { "role": "user", "content": "Which user has created the wallet with the most recent creation timestamp? Please provide the user_id and the corresponding wallet address." }, { "role": "assistant", "content": "SELECT user_id, address FROM web3.wallets ORDER BY created_at DESC LIMIT 1;" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "List all accounts for customers who have at least one account with a balance over 10000 and another account with a balance under 1000. Show customer_id, account_id, account_type, balance, and currency." }, { "role": "assistant", "content": "SELECT account_id , cust...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "List each user along with the number of wallets they own and the number of unique addresses found in their UTXOs." }, { "role": "assistant", "content": "SELECT u.user_id, COUNT(DISTINCT w.wallet_id) as wallet_count, COUNT(DISTINCT ut.address) as unique_utxo_addresse...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same...
[ { "role": "user", "content": "For each loan, calculate the number of days until maturity. Display loan_id, account_id, maturity_date, and days_to_maturity as the difference between maturity_date and CURRENT_DATE." }, { "role": "assistant", "content": "SELECT loan_id,\n account_id,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room...
[ { "role": "user", "content": "List each property_name and the count of available rooms." }, { "role": "assistant", "content": "SELECT p.property_name,\n COUNT(*) AS available_rooms_count\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.properties p\n ON r.property_id = p....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c...
[ { "role": "user", "content": "List all policies that have been cancelled, showing the policy number, cancelled date, and cancellation reason." }, { "role": "assistant", "content": "SELECT policy_number, cancellation_date, cancellation_reason FROM insurance.policies WHERE cancellation_date IS NOT...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.appointments ( appointment_id text, citizen_id text, employee_id text, location_id text, service_id...
[ { "role": "user", "content": "Count the number of appointments that have a status of 'Cancelled'." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM government_services.appointments WHERE status = 'Cancelled';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id text, route_id text, vehicle_id text, driver_id text, scheduled_departure timestamp, act...
[ { "role": "user", "content": "For each trip, show the scheduled and actual arrival time alongside the vehicle_id and driver_id. Only include trips where the actual arrival was later than the scheduled arrival." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id, schedule...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad...
[ { "role": "user", "content": "Show me the full name and email of each client along with the subject and location of all appointments they have, and include the name of the lawyer for each appointment." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS client_full...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti...
[ { "role": "user", "content": "Which achievements were unlocked by the same player at exactly the same timestamp?" }, { "role": "assistant", "content": "SELECT a.player_id,\n a.achievement_id AS ach1,\n b.achievement_id AS ach2,\n a.unlocked_at\nFROM gaming_technology.player_ach...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "Find all pairs of users who signed up on the same day. Return both usernames and the signup date." }, { "role": "assistant", "content": "SELECT u1.username AS user1, u2.username AS user2, DATE(u1.created_at) AS signup_date\nFROM social_media.users u1\nJOIN social_me...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry ...
[ { "role": "user", "content": "List all diagnosis entries that are marked as chronic and have a status of 'Active'. Show diagnosis ID, patient ID, and description." }, { "role": "assistant", "content": "SELECT diagnosis_id, patient_id, description FROM healthcare.diagnoses WHERE is_chronic = TRUE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty...
[ { "role": "user", "content": "How many diagnoses does each status have grouped by is_chronic flag?" }, { "role": "assistant", "content": "SELECT is_chronic, status, COUNT(*) AS count FROM healthcare.diagnoses GROUP BY is_chronic, status;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, depa...
[ { "role": "user", "content": "Which managers supervise employees in more than one department? Show the manager's first and last name and the distinct departments." }, { "role": "assistant", "content": "SELECT m.first_name AS manager_first_name, m.last_name AS manager_last_name, COUNT(DISTINCT e....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.t...
[ { "role": "user", "content": "Show me all NFT holders who own more than 10 of the same token, including the contract address, token ID, and wallet address." }, { "role": "assistant", "content": "SELECT nh.contract_address, nh.token_id, nh.wallet_address, CAST(nh.amount AS decimal) AS token_count...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Show me the first name, last name, and date of birth for all patients who are male." }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE gender = 'Male';" }, { "role": "user", "content": "Pleas...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "List players who have completed at least one game session with a score greater than 100, showing their player_id and username." }, { "role": "assistant", "content": "SELECT DISTINCT T1.player_id, T1.username FROM gaming_technology.players AS T1 JOIN gaming_technolog...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Retrieve the total revenue and order count for each department for services in July 2023. Show department, revenue, and order_count." }, { "role": "assistant", "content": "SELECT s.department,\n SUM(o.total_price) AS revenue,\n COUNT(o.order_id) AS order...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "Show the first name, last name, and contact information for beneficiaries added before 2023." }, { "role": "assistant", "content": "SELECT first_name, last_name, contact_info FROM insurance.policy_beneficiaries WHERE added_at < '2023-01-01';" }, { "role": "u...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "List all agents who have a commission rate above 0.1, showing their full names and agency names." }, { "role": "assistant", "content": "SELECT agent_id, first_name, last_name, agency_name, commission_rate FROM insurance.agents WHERE commission_rate > 0.1 AND status ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "I need to find patients who received prescriptions within 7 days after their latest appointment. Show patient_id, first and last name, appointment_time, prescription_date, and medication_name." }, { "role": "assistant", "content": "WITH latest_appt AS (\n SELECT pa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "How many premium payments were made using 'Credit Card' as the payment method?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS credit_card_payments\nFROM insurance.premium_payments\nWHERE payment_method = 'Credit Card';" } ]
You are an expert in writing database language. You can write a corresponding 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, project_id character...
[ { "role": "user", "content": "List tokens associated with the 'AI' narrative. For each token, show its symbol and current price. Also include the 24-hour volume for the 'AI' narrative itself." }, { "role": "assistant", "content": "SELECT T1.token_symbol, T1.price, T2.volume_24h FROM token_basic_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Show me for each loan_type, the total number of loans and the average principal_amount, along with the average account balance for the accounts associated with those loans." }, { "role": "assistant", "content": "SELECT l.loan_type, COUNT(l.loan_id) AS loan_count, AV...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "How many patients are there in each gender category?" }, { "role": "assistant", "content": "SELECT gender,\n COUNT(*) AS patient_count\nFROM healthcare.patients\nGROUP BY gender;" }, { "role": "user", "content": "Limit this to categories with more ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol ch...
[ { "role": "user", "content": "Show the top 3 tokens on Polygon with the greatest positive price change over the last 6 hours, including their symbol, price, 6h change, and the number of smart money buy addresses in the last 24h." }, { "role": "assistant", "content": "SELECT tdi.token_symbol, tdi...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t...
[ { "role": "user", "content": "List the name of NFTs and their contract name, along with the symbol and total supply from the token information table, for NFTs on the 'ethereum' blockchain." }, { "role": "assistant", "content": "SELECT T1.name, T1.contract_name, T2.symbol, T2.total_supply FROM nf...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "Compute the total and average amount_paid for completed premium payments, grouped by payment_method." }, { "role": "assistant", "content": "SELECT payment_method, SUM(amount_paid) AS total_paid, AVG(amount_paid) AS average_paid\nFROM insurance.premium_payments\nWHER...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Show me a list of all appointments with the subject and full name of the assigned lawyer." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.subject, l.first_name || ' ' || l.last_name AS lawyer_full_name\nFROM legal_services.appointments a\nJOIN lega...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "List all policy beneficiaries with their relationship and the date they were added, ordered by added_at descending." }, { "role": "assistant", "content": "SELECT first_name, last_name, relationship, added_at\nFROM insurance.policy_beneficiaries\nORDER BY added_at DE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu...
[ { "role": "user", "content": "Retrieve all room types where the base rate exceeds 200, listing the type name and base rate." }, { "role": "assistant", "content": "SELECT type_name, base_rate FROM hospitality_technology.room_types WHERE base_rate > 200" }, { "role": "user", "content":...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ...
[ { "role": "user", "content": "List the five most recently issued policies with their policy_id, policy_number, issued_at, and status." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, issued_at, status\nFROM insurance.policies\nORDER BY issued_at DESC\nLIMIT 5;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "List all active drivers with their license expiry dates and contact information." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, license_number, license_expiry_date, contact_number, email FROM transportation.drivers WHERE status = 'ac...
You are an expert in writing database language. You can write a corresponding 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": "Display the details of all UTXOs with a 'spent' status of false." }, { "role": "assistant", "content": "SELECT utxo_id, transaction_id, output_index, address, amount FROM trading_platform.utxos WHERE spent = false;" }, { "role": "user", "content": "For t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "For each passenger, show their passenger_id, first_name, last_name, the date and time of their earliest booking, and the date and time of their latest booking." }, { "role": "assistant", "content": "SELECT p.passenger_id,\n p.first_name,\n p.last_name,\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Show me the names of citizens who have both uploaded at least one document and have made a payment, along with the total payment amount and the number of documents they have uploaded." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, SUM(p.amo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i...
[ { "role": "user", "content": "Show a combination of all chronic diagnoses and all insurance plans of type 'HMO'. Display the diagnosis description and the plan name." }, { "role": "assistant", "content": "SELECT T1.description, T2.plan_name FROM healthcare.diagnoses AS T1 CROSS JOIN healthcare.i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "Summarize the accounts table by account type and currency, showing the average balance for each combination." }, { "role": "assistant", "content": "SELECT account_type, currency, AVG(balance) AS average_balance, COUNT(account_id) AS account_count FROM financial_serv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "For each chain, which centralized exchange holds the largest total USD value in their token balance as of the most recent snapshot?" }, { "role": "assistant", "content": "WITH latest_snapshot AS (\n SELECT MAX(snapshot_time) AS max_time FROM cex_token_balance\n)\nS...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address cha...
[ { "role": "user", "content": "What is the average and maximum total_supply for tokens grouped by decimals? Provide columns: decimals, avg_supply, max_supply." }, { "role": "assistant", "content": "SELECT decimals,\n AVG(total_supply) AS avg_supply,\n MAX(total_supply) AS max_supply\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,...
[ { "role": "user", "content": "Show me all appointments scheduled for tomorrow with a duration longer than 45 minutes, including patient_id, doctor_id, and appointment_time." }, { "role": "assistant", "content": "SELECT patient_id, doctor_id, appointment_time FROM healthcare.appointments WHERE DA...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego...
[ { "role": "user", "content": "Show the service names that had documents uploaded for their applications in the calendar year 2023." }, { "role": "assistant", "content": "SELECT DISTINCT T1.service_name FROM government_services.services AS T1 JOIN applications AS T2 ON T1.service_id = T2.service_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Show the total fare collected from bookings, grouped by the state/province of the destination location of the trip, for bookings made in May 2024." }, { "role": "assistant", "content": "SELECT\n l.state_province,\n SUM(b.fare) AS total_fare_collected\nFROM transpo...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "List the usernames of users who have joined a conversation and sent at least one message in it. Include the conversation_id for each." }, { "role": "assistant", "content": "SELECT DISTINCT u.username, cp.conversation_id\nFROM social_media.conversation_participants c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.post_hashtags ( post_hashtag_id.text, post_id.text, hashtag_id.text ) CREATE TABLE social_media.conversati...
[ { "role": "user", "content": "List all conversation participants along with post_hashtag details where the participant's user_id matches the hashtag_id." }, { "role": "assistant", "content": "SELECT cp.conversation_id, cp.user_id, ph.post_id, ph.hashtag_id\nFROM social_media.conversation_partici...