conversations
listlengths
2
8
system
stringlengths
280
8.03k
[ { "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 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.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text,...
[ { "role": "user", "content": "Find all addresses with a balance greater than 1000, ordered by balance in descending order." }, { "role": "assistant", "content": "SELECT address_id, public_key, balance FROM blockchain.addresses WHERE balance > 1000 ORDER BY balance DESC;" }, { "role": "us...
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 blockchain.addresses ( address_id text PRIMARY KEY, public_key text, balance numeric )
[ { "role": "user", "content": "List the first name, last name, and firm name for all lawyers who are partners." }, { "role": "assistant", "content": "SELECT T1.first_name , T1.last_name , T2.firm_name FROM legal_services.lawyers AS T1 JOIN law_firms AS T2 ON T1.firm_id = T2.firm_id WHERE T1.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 legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer first_n...
[ { "role": "user", "content": "How many unread notifications are there with the type 'mention'?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.notifications WHERE read_at IS NULL AND notification_type = 'mention';" } ]
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.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou...
[ { "role": "user", "content": "Show me a summary of all clients with the total number of invoices they've received and the sum of total_amount for those invoices." }, { "role": "assistant", "content": "SELECT cl.client_id,\n CONCAT(cl.first_name, ' ', cl.last_name) AS client_name,\n 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "Find pairs of insurance plans that are offered by the same insurance provider. Show the provider name, and the names of the two plans." }, { "role": "assistant", "content": "SELECT p1.insurance_provider, p1.plan_name, p2.plan_name FROM healthcare.insurance_plans p1 ...
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.insurance_plans ( plan_id character varying(64) NOT NULL, plan_name character varying(200) NOT NULL, insuran...
[ { "role": "user", "content": "Please show me all locations that do not have a state or province recorded. Include the location name, city, and country." }, { "role": "assistant", "content": "SELECT name, city, country\nFROM transportation.locations\nWHERE state_province IS NULL OR state_province...
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.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "Show each contract's address along with the total number of events it has emitted and the total number of transactions sent to it." }, { "role": "assistant", "content": "SELECT\n c.address,\n COUNT(e.event_id) AS event_count,\n COUNT(t.transaction_id) AS tx_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 web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the contract address cha...
[ { "role": "user", "content": "Show me the list of hashtags that have been used, along with the time they were first used." }, { "role": "assistant", "content": "SELECT tag_name, created_at \nFROM social_media.hashtags;" } ]
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 character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "List each group conversation with its group name and the number of verified users who have posted in it." }, { "role": "assistant", "content": "SELECT c.conversation_id, c.group_name, COUNT(DISTINCT u.user_id) AS verified_posters\nFROM social_media.conversations c\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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Show the prescription ID, medication name, and patient full name for all prescriptions issued in the last 30 days." }, { "role": "assistant", "content": "SELECT pr.prescription_id, m.medication_name, CONCAT(p.first_name, ' ', p.last_name) AS patient_name\nFROM healt...
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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me all terminated drivers who had worked for the company for more than 5 years before termination." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, hire_date FROM transportation.drivers WHERE status = 'Terminated' AND (hire_date <...
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 character varying(64) NOT NULL, -- unique identifier for the driver employe...
[ { "role": "user", "content": "Show me all active electric vehicles along with their make, model, and license plate, ordered by acquisition date with the newest first." }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, license_plate, acquisition_date FROM transportation.vehicl...
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 character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "How many documents of each type exist in the system? Show the document type and the count." }, { "role": "assistant", "content": "SELECT document_type, COUNT(*) AS document_count\nFROM legal_services.documents\ngroup BY document_type;" } ]
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": "How many documents were uploaded in the year 2023?" }, { "role": "assistant", "content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;" } ]
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.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz...
[ { "role": "user", "content": "List all premium payments for policy 'POL123'. Show payment ID, payment date, amount paid, and status." }, { "role": "assistant", "content": "SELECT payment_id, payment_date, amount_paid, status FROM insurance.premium_payments WHERE policy_id = 'POL123';" }, { ...
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.premium_payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment po...
[ { "role": "user", "content": "Summarize trade activity by account and execution venue, showing the total quantity of shares traded and the average commission paid." }, { "role": "assistant", "content": "SELECT account_id, execution_venue, SUM(quantity) AS total_quantity, AVG(commission) AS avera...
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.trades ( trade_id text, account_id text, security_id text, order_id text, trade_type text, quantity ...
[ { "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 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": "List the latest version of each document (identified by case_id and document_name), showing the version number and its upload_timestamp." }, { "role": "assistant", "content": "SELECT d.case_id,\n d.document_name,\n d.version AS latest_version,\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 legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u...
[ { "role": "user", "content": "Show me all premium payments made in Q1 2023, along with their payment methods and amounts, sorted by payment date." }, { "role": "assistant", "content": "SELECT payment_method, amount_paid, payment_date FROM insurance.premium_payments WHERE payment_date BETWEEN '20...
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.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo...
[ { "role": "user", "content": "I want to find the total number of ERC1155 \"approval-for-all\" events per contract. Show contract_address and the approval_count." }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) AS approval_count\nFROM erc1155_approval_for_all\nGROUP BY con...
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_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "For each user, show their user_id, KYC status, and the total count of completed orders they've placed." }, { "role": "assistant", "content": "SELECT k.user_id, k.status, COUNT(o.order_id) AS completed_order_count\nFROM trading_platform.kyc_audit k\nJOIN trading_plat...
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": "Show me all intercity routes that have an estimated duration of more than 2 hours, along with their origin and destination locations." }, { "role": "assistant", "content": "SELECT r.route_id, r.route_number, r.estimated_duration_minutes, lo.name AS origin_location, ...
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 character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "List all pairs of properties located in the same city, showing each pair's property IDs and names along with the city." }, { "role": "assistant", "content": "SELECT p1.property_id AS property_id_1,\n p1.property_name AS property_name_1,\n p2.property_id ...
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, property_name character varying(255) NO...
[ { "role": "user", "content": "Show all tokens on the 'Arbitrum' chain from DEX pools that have a 24-hour trading volume between $100,000 and $500,000. Display token symbol, price, and volume_24h." }, { "role": "assistant", "content": "SELECT\n token_symbol,\n price,\n volume_24h\nFROM token_d...
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, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "Show all transactions over 10,000 USD that are not marked as 'REVERSED'." }, { "role": "assistant", "content": "SELECT transaction_id, account_id, amount, currency, status, transaction_date\nFROM financial_services.transactions\nWHERE amount > 10000 AND currency = '...
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": "List all wallets that were created during the hour of the day which saw the highest number of wallet creations. Show the wallet ID, user ID, address, and creation timestamp." }, { "role": "assistant", "content": "WITH HourlyCounts AS (\n SELECT EXTRACT(HOUR FROM ...
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 text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "List all active SUI coins with their symbol, name, and total balance across all owners." }, { "role": "assistant", "content": "SELECT scm.coin_type, scm.symbol, scm.name, SUM(CAST(sc.balance AS DECIMAL)) AS total_balance\nFROM sui_coins_metadata scm\nJOIN sui_coins ...
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_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Return the number of top-level comments and the number of replies in the comments table." }, { "role": "assistant", "content": "SELECT\n SUM(CASE WHEN parent_comment_id IS NULL THEN 1 ELSE 0 END) AS top_level_comments,\n SUM(CASE WHEN parent_comment_id IS NOT NULL...
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, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Find all pairs of distinct medications manufactured by the same company, showing med1.medication_id, med1.medication_name, med2.medication_id, med2.medication_name, and the manufacturer." }, { "role": "assistant", "content": "SELECT m1.medication_id AS med1_id, m1.m...
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.medications ( medication_id.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,...
[ { "role": "user", "content": "Can you show me the number of servers in each region, as well as the total max_players for each region?" }, { "role": "assistant", "content": "SELECT region, COUNT(*) AS server_count, SUM(max_players) AS total_max_players FROM gaming_technology.servers GROUP BY regi...
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.servers ( server_id uuid, game_id uuid, server_name text, region text, ip_address text, port integer,...
[ { "role": "user", "content": "Show me all vehicles that are currently out of service (status = 'out_of_service'), including their make, model, and the reason (type field)." }, { "role": "assistant", "content": "SELECT vehicle_id, make, model, type FROM transportation.vehicles WHERE status = 'out...
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 character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "Can you list the number of citizens registered each month in 2024? Please show the month and the citizen count." }, { "role": "assistant", "content": "SELECT TO_CHAR(registration_date, 'YYYY-MM') AS registration_month, COUNT(*) AS citizen_count FROM government_servi...
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, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Show the plan name and insurance provider for all insurance plans along with the total number of unique patients enrolled in each plan." }, { "role": "assistant", "content": "SELECT ip.plan_name, ip.insurance_provider, COUNT(DISTINCT pi.patient_id) AS enrolled_patie...
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": "What is the total revenue generated for each department from delivered service orders? Return department and total_revenue." }, { "role": "assistant", "content": "SELECT s.department,\n SUM(so.total_price) AS total_revenue\nFROM hospitality_technology.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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Find all appointments at location_id 'LOC123' where the reason contains 'follow-up' and the status is 'Scheduled', showing appointment_time and patient_id." }, { "role": "assistant", "content": "SELECT appointment_time, patient_id FROM healthcare.appointments WHERE ...
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": "Find pairs of insurance policies where the plan_id is the same, but they belong to different patients. Show the plan_id, and the patient_id and policy_number for both policies in the pair." }, { "role": "assistant", "content": "SELECT T1.plan_id, T1.patient_id AS 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 healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb...
[ { "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 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": "How many addresses on the Polygon chain have an ROI above 5?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE chain = 'Polygon' AND roi > 5;" }, { "role": "user", "content": "Also show the average prof...
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 smart_money_profit ( address text, rank numeric, profit numeric, roi numeric, realized_ratio numeric, most_profit_token...
[ { "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...
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.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "List prescription ID, medication ID, and the record ID for all prescriptions linked to medical records where the chief complaint contains 'cough'." }, { "role": "assistant", "content": "SELECT T1.prescription_id, T1.medication_id, T1.record_id FROM healthcare.prescr...
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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show the usernames and registration dates for all players whose status is 'inactive'." }, { "role": "assistant", "content": "SELECT username, registration_date FROM players WHERE status = 'inactive';" }, { "role": "user", "content": "Refine the list to 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show me the total number of sessions and the total duration in seconds for each server, including the server name and the game title." }, { "role": "assistant", "content": "SELECT\n s.server_name,\n g.game_title,\n COUNT(gs.session_id) AS total_sessions,\n SUM(g...
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.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, server_id.uuid, start_time.timestamptz...
[ { "role": "user", "content": "For each player, show their player_id and the number of unique games they have played sessions on." }, { "role": "assistant", "content": "SELECT player_id, COUNT(DISTINCT game_id) AS unique_games\nFROM gaming_technology.game_sessions\nGROUP BY player_id;" }, { ...
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, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "Please list the full name and status of clients who have not provided a company name." }, { "role": "assistant", "content": "SELECT first_name, last_name, status\nFROM legal_services.clients\nWHERE company_name IS NULL;" } ]
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": "List the name of each agency and the total number of service locations it operates in New York State." }, { "role": "assistant", "content": "SELECT a.agency_name, COUNT(sl.location_id) AS location_count\nFROM government_services.agencies a\nLEFT JOIN government_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 government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e...
[ { "role": "user", "content": "For each service location, find its nearest accessible location by geographic distance." }, { "role": "assistant", "content": "SELECT sl.location_id,\n sl.location_name,\n nearest.location_id AS nearest_location_id,\n nearest.location_name AS nea...
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.service_locations ( location_id.text, agency_id.text, location_name.text, address.text, city.text, ...
[ { "role": "user", "content": "List each property along with the count of available rooms grouped by bed type." }, { "role": "assistant", "content": "SELECT rt.property_id, p.property_name, rt.bed_type, COUNT(r.room_id) AS available_count\nFROM hospitality_technology.rooms r\nJOIN hospitality_tec...
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 text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "Show me all documents uploaded by lawyers from law firms located in 'New York'. Include the document name, upload timestamp, the first and last name of the uploading lawyer, and the firm name." }, { "role": "assistant", "content": "SELECT d.document_name, d.upload_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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List the content and sent time for messages sent by user 'U101'." }, { "role": "assistant", "content": "SELECT content, sent_at FROM social_media.messages WHERE sender_user_id = 'U101';" }, { "role": "user", "content": "Could you also include the group 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 social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message convers...