system stringlengths 315 8.06k | conversations listlengths 2 48 |
|---|---|
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quantity numeric, price numeric, status text, created_at timestamp )
CREATE TABLE trading_platform.dapps ( dapp_id text PRIMARY KEY, name text, description text, url text )
CREATE TABLE trading_platform.peers ( peer_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
CREATE TABLE trading_platform.metadata ( metadata_id text PRIMARY KEY, asset_id text, key text, value text )
CREATE TABLE trading_platform.kyc_audit ( kyc_audit_id text PRIMARY KEY, user_id text, status text, reviewed_at timestamp )
CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
CREATE TABLE trading_platform.notifications ( notification_id text PRIMARY KEY, user_id text, message text, sent_at timestamp, read_at timestamp )
| [
{
"role": "user",
"content": "How many unread notifications does each user have?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT user_id,\n COUNT(*) AS unread_notifications\nFROM trading_platform.notifications\nWHERE read_at IS NULL\nGROUP BY user_id;",
"sql": null
},
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (hashtag_id) )
| [
{
"role": "user",
"content": "List all pairs of hashtags created on the same calendar date, showing both tag names and the creation date.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT h1.tag_name AS tag1, h2.tag_name AS tag2, DATE(h1.created_at) AS created_date\nFROM 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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number text, email text, hospital_affiliation_id text, created_at timestamp, updated_at timestamp )
CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_minutes integer, reason text, status text, location_id text, notes text, created_at timestamp )
CREATE TABLE healthcare.medical_records ( record_id text, patient_id text, appointment_id text, doctor_id text, record_date timestamp, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals text, created_at timestamp )
CREATE TABLE healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text, description text )
CREATE TABLE healthcare.prescriptions ( prescription_id text, record_id text, patient_id text, doctor_id text, medication_id text, dosage text, frequency text, route text, start_date date, end_date date, quantity_dispensed numeric, refills_allowed integer, prescription_date timestamp )
CREATE TABLE healthcare.insurance_plans ( plan_id text, plan_name text, insurance_provider text, plan_type text, contact_phone text, website text )
CREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_number text, subscriber_name text, effective_date date, expiration_date date, is_primary boolean )
| [
{
"role": "user",
"content": "Retrieve all unique chief complaints from medical_records.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT DISTINCT chief_complaint\nFROM healthcare.medical_records;",
"sql": null
},
{
"role": "user",
"content": "Now show chief complai... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
case_id character varying(64) NOT NULL, -- FK to cases table
document_name character varying(255) NOT NULL, -- name of the document file
document_type character varying(100), -- e.g., Pleading, Contract, Evidence, Correspondence
storage_path text NOT NULL, -- path or reference to the document storage location
uploaded_by_lawyer_id character varying(64), -- FK to lawyers table (who uploaded it)
upload_timestamp timestamp NOT NULL, -- time the document was uploaded
version integer DEFAULT 1, -- document version number
description text, -- brief description or notes about the document
PRIMARY KEY (document_id)
)
| [
{
"role": "user",
"content": "Find pairs of documents in the same case where one document is version 1 and the other is the highest version for that document_name, showing case_id, document_name, version1, latest_version, version1_upload_timestamp, and latest_upload_timestamp.",
"sql": null
},
{
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record entry
patient_id character varying(64) NOT NULL, -- FK to patients table
appointment_id character varying(64) UNIQUE, -- FK to appointments table (can be null if record not tied to specific appt)
doctor_id character varying(64) NOT NULL, -- FK to doctors table (doctor creating the record)
record_date timestamp with time zone NOT NULL, -- date the record/observation was made
chief_complaint text, -- patient's primary reason for visit
present_illness_history text, -- detailed history of the current issue
past_medical_history text, -- relevant past conditions/surgeries
physical_examination_notes text, -- findings from the physical exam
assessment text, -- doctor's assessment/diagnosis summary
treatment_plan text, -- planned course of action
vitals jsonb, -- store vitals like BP, HR, Temp as structured JSON
created_at timestamp with time zone NOT NULL DEFAULT current_timestamp,
PRIMARY KEY (record_id)
)
| [
{
"role": "user",
"content": "List each patient's first and last medical record entries, showing patient_id, earliest_record_id, earliest_record_date, latest_record_id, and latest_record_date.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT\n fl.patient_id,\n fr.record_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 government_services.appointments ( appointment_id text, citizen_id text, employee_id text, location_id text, service_id text, scheduled_start_time timestamp, scheduled_end_time timestamp, purpose text, status text, booking_method text, created_at timestamp, notes text )
| [
{
"role": "user",
"content": "Can you list all appointments along with the scheduled start time, purpose, and booking method, as well as the employee ID and location ID for each appointment?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT appointment_id, scheduled_start_time, purp... |
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.passengers (
passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger
first_name character varying(128) NOT NULL, -- passenger's first name
last_name character varying(128) NOT NULL, -- passenger's last name
email character varying(128) UNIQUE, -- email address
phone_number character varying(32) UNIQUE, -- phone number
date_of_birth date, -- passenger's date of birth
loyalty_program_id character varying(64), -- identifier for loyalty program membership
created_at timestamp with time zone NOT NULL, -- time when the passenger record was created
PRIMARY KEY (passenger_id)
)
CREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_id character varying(64) NOT NULL, seat_number character varying(16), booking_time timestamp with time zone NOT NULL, status character varying(32) NOT NULL, fare numeric(10, 2) NOT NULL, payment_transaction_id character varying(128), special_requests text, PRIMARY KEY (booking_id) )
| [
{
"role": "user",
"content": "Show me all bookings with the passenger's full name and the booking status.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT b.booking_id, p.first_name || ' ' || p.last_name AS passenger_full_name, b.status\nFROM transportation.bookings b\nJOIN transpo... |
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, product_type text, description text, base_premium numeric, coverage_details text, underwriting_rules text, is_active boolean, created_at timestamp, updated_at timestamp )
| [
{
"role": "user",
"content": "Get the number of insurance products grouped by product_type and their active status. Return product_type, is_active, and the count of products.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT product_type, is_active, COUNT(*) AS product_count\nFROM i... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id text PRIMARY KEY, reservation_id text, guest_id text, service_id text, staff_id_ordered text, staff_id_delivered text, order_timestamp timestamp, delivery_timestamp timestamp, quantity int, unit_price numeric, total_price numeric, status text, notes text, bill_id text )
| [
{
"role": "user",
"content": "List all service orders with quantity greater than 3, showing the order ID, total price, and the staff member who placed the order.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT order_id, total_price, staff_id_ordered\nFROM hospitality_technology.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.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time timestamptz, end_time timestamptz, duration_seconds int, score int, session_data jsonb )
| [
{
"role": "user",
"content": "For each server, what is the earliest and latest start time of its sessions?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT server_id, MIN(start_time), MAX(start_time) FROM gaming_technology.game_sessions GROUP BY server_id;",
"sql": null
},
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, investment_date.text, introduction.text, valuation.numeric )
CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.text, chain.text, price.numeric, price_change_percentage_1h.numeric, price_change_percentage_24h.numeric, price_change_percentage_7d.numeric, highest_price_24h.numeric, lowest_price_24h.numeric, market_cap.numeric, market_cap_rank.numeric, market_cap_change_percentage_24h.text, total_volume.text, narrative.text, trend_rank.numeric )
CREATE TABLE token_dexpool_info ( pair_address.text, token_name.text, token_symbol.text, chain.text, price.numeric, price_change_percentage_1h.numeric, price_change_percentage_6h.numeric, price_change_percentage_24h.numeric, makers_24h.numeric, volume_24h.numeric, liquidity.numeric, market_cap.numeric, trend_rank.numeric )
CREATE TABLE cex_token_balance ( snapshot_time.text, chain.text, address.text, exchange.text, token_address.text, token_symbol.text, balance.numeric, usd_value.numeric, price.numeric )
CREATE TABLE smart_money_token_inflow ( token_address.text, token_symbol.text, token_amount.numeric, usd_value.numeric, avg_price.numeric, type.numeric, address_amount.numeric, narrative.text, chain.text )
| [
{
"role": "user",
"content": "For each chain in the smart money token inflow data, calculate the total number of addresses involved in buy transactions and the total number of addresses involved in sell transactions. Display the chain, total buy addresses, and total sell addresses.",
"sql": null
},
... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.fuel_logs (
fuel_log_id character varying(64) NOT NULL, -- unique identifier for the fuel log entry
vehicle_id character varying(64) NOT NULL, -- identifier of the vehicle fueled
trip_id character varying(64), -- optional: identifier of the trip during which fueling occurred
log_timestamp timestamp with time zone NOT NULL, -- time when fueling occurred
fuel_type character varying(32) NOT NULL, -- type of fuel added (matches vehicle's fuel type)
quantity numeric(10, 3) NOT NULL, -- amount of fuel added (e.g., Liters, Gallons, kWh)
unit character varying(16) NOT NULL, -- unit of quantity (e.g., L, gal, kWh)
cost_per_unit numeric(8, 4), -- price per unit of fuel
total_cost numeric(10, 2) NOT NULL, -- total cost of the fuel purchase
odometer_reading integer, -- vehicle mileage at time of fueling
location_id character varying(64), -- identifier of the fueling station/location
PRIMARY KEY (fuel_log_id)
)
| [
{
"role": "user",
"content": "For each trip, provide the trip_id, the total fuel quantity refueled, and the number of refueling events that occurred during the trip.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT trip_id, SUM(quantity) AS total_fuel_quantity, COUNT(*) AS refuel_e... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id character varying(64) NOT NULL, agent_id character varying(64), policy_number character varying(100) NOT NULL UNIQUE, start_date date NOT NULL, end_date date NOT NULL, premium_amount numeric(12, 2) NOT NULL, coverage_limit numeric(15, 2) NOT NULL, deductible numeric(10, 2) NOT NULL, status character varying(30) NOT NULL, issued_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, cancellation_date date, cancellation_reason text, PRIMARY KEY (policy_id) )
| [
{
"role": "user",
"content": "List all policies that have a coverage limit greater than 750000 and a premium amount greater than 1000. Show the policy number, product ID, coverage limit, and premium amount.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT\n policy_number,\n produ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id character varying(64) NOT NULL, agent_id character varying(64), policy_number character varying(100) NOT NULL UNIQUE, start_date date NOT NULL, end_date date NOT NULL, premium_amount numeric(12, 2) NOT NULL, coverage_limit numeric(15, 2) NOT NULL, deductible numeric(10, 2) NOT NULL, status character varying(30) NOT NULL, issued_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, cancellation_date date, cancellation_reason text, PRIMARY KEY (policy_id) )
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, incident_date timestamp NOT NULL, reported_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, description text NOT NULL, estimated_loss numeric(15, 2), status character varying(30) NOT NULL, settlement_amount numeric(15, 2), settlement_date date, claim_handler_id character varying(64), police_report_number character varying(100), PRIMARY KEY (claim_id) )
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL, product_type character varying(50) NOT NULL, description text, base_premium numeric(10, 2) NOT NULL, coverage_details text, underwriting_rules text, is_active boolean NOT NULL DEFAULT true, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at timestamp, PRIMARY KEY (product_id) )
CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id character varying(64) NOT NULL, document_type character varying(50) NOT NULL, file_name character varying(255) NOT NULL, file_path character varying(512) NOT NULL, file_size_bytes integer, mime_type character varying(100), uploaded_by character varying(64), uploaded_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, description text, PRIMARY KEY (document_id) )
| [
{
"role": "user",
"content": "Show me the incident date, estimated loss, and the associated product name for all claims with an estimated loss greater than 20000.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT c.incident_date, c.estimated_loss, p.product_name\nFROM insurance.clai... |
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.text, tag_name.text, created_at.timestamp )
| [
{
"role": "user",
"content": "List all pairs of hashtags created within the same hour, including both hashtag IDs and their creation timestamps.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT h1.hashtag_id AS hashtag1_id, h1.created_at AS created1, h2.hashtag_id AS hashtag2_id, h... |
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.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state.text, contact_email.text, contact_phone.text, hire_date.date, termination_date.date, status.text, commission_rate.numeric, manager_id.text )
| [
{
"role": "user",
"content": "I want to retrieve the agent ID, first and last name, along with their manager's contact email and phone number.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT a.agent_id,\n a.first_name || ' ' || a.last_name AS agent_name,\n m.contact_em... |
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 character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(10), address text, phone_number character varying(20), email character varying(128) UNIQUE, emergency_contact_name character varying(200), emergency_contact_phone character varying(20), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (patient_id) )
CREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, specialty character varying(100) NOT NULL, license_number character varying(50) UNIQUE NOT NULL, phone_number character varying(20), email character varying(128) UNIQUE, hospital_affiliation_id character varying(64), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (doctor_id) )
CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appointment_id character varying(64) UNIQUE, doctor_id character varying(64) NOT NULL, record_date timestamp with time zone NOT NULL, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals jsonb, created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (record_id) )
CREATE TABLE healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text, description text )
CREATE TABLE healthcare.prescriptions ( prescription_id.text, record_id.text, patient_id.text, doctor_id.text, medication_id.text, dosage.text, frequency.text, route.text, start_date.date, end_date.date, quantity_dispensed.numeric, refills_allowed.integer, prescription_date.timestamp )
| [
{
"role": "user",
"content": "List all prescriptions with the corresponding patient's emergency contact name and phone number. Show prescription ID, patient full name, emergency contact name, and emergency contact phone.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT pr.prescript... |
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.follows ( follow_id.text, follower_user_id.text, following_user_id.text, created_at.timestamp )
| [
{
"role": "user",
"content": "How many users have followed more than one person in total?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT follower_user_id, COUNT(DISTINCT following_user_id) AS following_count\nFROM social_media.follows\nGROUP BY follower_user_id\nHAVING COUNT(DIST... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name character varying(128) NOT NULL, -- name of the asset
symbol character varying(32) NOT NULL, -- symbol of the asset
type character varying(32) NOT NULL, -- type of the asset (e.g., cryptocurrency, stock)
PRIMARY KEY (asset_id)
)
CREATE TABLE trading_platform.utxos (
utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO
transaction_id character varying(64) NOT NULL, -- identifier of the transaction that created the UTXO
output_index integer NOT NULL, -- index of the output in the transaction
address character varying(128) NOT NULL, -- address that can spend the UTXO
amount numeric(38,14) NOT NULL, -- amount of the asset in the UTXO
spent boolean NOT NULL, -- whether the UTXO has been spent
PRIMARY KEY (utxo_id)
)
CREATE TABLE trading_platform.dapps (
dapp_id character varying(64) NOT NULL, -- unique identifier for the DApp
name character varying(128) NOT NULL, -- name of the DApp
description text NOT NULL, -- description of the DApp
url character varying(256) NOT NULL, -- URL of the DApp
PRIMARY KEY (dapp_id)
)
| [
{
"role": "user",
"content": "I want a list of DApp names and the asset symbols mentioned in their descriptions.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT d.name AS dapp_name,\n a.symbol AS asset_symbol\nFROM trading_platform.dapps d\nJOIN trading_platform.assets 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 web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character varying(128) NOT NULL, data text NOT NULL, emitted_at timestamp NOT NULL, transaction_id character varying(64) NOT NULL, log_index integer NOT NULL, PRIMARY KEY (event_id) )
| [
{
"role": "user",
"content": "Count the number of events for each hour of the day based on the emitted_at timestamp.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT EXTRACT(HOUR FROM emitted_at) AS event_hour, COUNT(*) AS event_count FROM web3.events GROUP BY event_hour ORDER BY e... |
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, -- unique identifier for the government employee
agency_id character varying(64) NOT NULL, -- FK to agencies table
first_name character varying(100) NOT NULL,
last_name character varying(100) NOT NULL,
job_title character varying(150) NOT NULL,
department character varying(100),
work_email character varying(128) NOT NULL UNIQUE,
work_phone character varying(32),
hire_date date NOT NULL,
termination_date date, -- null if currently employed
access_level character varying(50), -- Role or permission level
manager_employee_id character varying(64), -- FK to self for reporting structure
PRIMARY KEY (employee_id)
)
| [
{
"role": "user",
"content": "List the full names of all employees who are currently employed (i.e., have no termination date).",
"sql": null
},
{
"role": "assistant",
"content": "SELECT first_name || ' ' || last_name AS full_name FROM government_services.employees WHERE termination_date 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.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id character varying(64) NOT NULL, -- identifier of the post being commented on (FK to posts.post_id)
user_id character varying(64) NOT NULL, -- identifier of the user who made the comment (FK to users.user_id)
parent_comment_id character varying(64), -- identifier of the parent comment if it's a reply (FK to comments.comment_id)
content text NOT NULL, -- textual content of the comment
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of comment creation
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of last comment edit
PRIMARY KEY (comment_id)
)
CREATE TABLE social_media.conversation_participants ( participant_id text, conversation_id text, user_id text, joined_at timestamp, last_read_at timestamp )
CREATE TABLE social_media.user_settings ( setting_id text, user_id text, theme text, email_notifications_enabled boolean, push_notifications_enabled boolean, private_profile boolean, updated_at timestamp )
| [
{
"role": "user",
"content": "List the content and comment ID for all comments made by users with private profiles.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT c.comment_id, c.content FROM social_media.comments AS c JOIN social_media.user_settings AS us ON c.user_id = us.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 hospitality_technology.room_types ( room_type_id.text, property_id.text, type_name.text, description.text, base_rate.numeric, max_occupancy.integer, bed_type.text, area_sqft.numeric, amenities.text )
| [
{
"role": "user",
"content": "Show all room types that offer 'WiFi' in their amenities.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT room_type_id, property_id, type_name, amenities FROM hospitality_technology.room_types WHERE amenities LIKE '%WiFi%';",
"sql": null
},
{
... |
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
CREATE TABLE manufacturing.aircraft_models ( model_id text PRIMARY KEY, model_name text, manufacturer text, passenger_capacity int, max_range_km int, engine_type text, wingspan_m numeric, status text, first_flight_date date )
| [
{
"role": "user",
"content": "What are the environmental impact assessments for the production of the Airbus A350 model?",
"sql": null
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to data regarding the environmental impact assessments for the production of specifi... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address text NOT NULL, phone character varying(32), website character varying(255), founded_date date, managing_partner_id character varying(64), PRIMARY KEY (firm_id) )
| [
{
"role": "user",
"content": "Show me the names, founding dates, and websites of all law firms whose name contains the word 'Legal' and were founded after the year 2005. Sort the results by their founding date.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT firm_name, founded_dat... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )
| [
{
"role": "user",
"content": "List all locations situated within the state of California.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT location_id, name, city, state_province FROM transportation.locations WHERE state_province = 'CA';",
"sql": null
},
{
"role": "user... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, currency_code text, payment_method text, card_type text, card_last_four text, transaction_ref text, payment_timestamp timestamp, status text, staff_id_processed text, notes text )
| [
{
"role": "user",
"content": "List all payments processed in USD, showing payment_id, guest_id, amount, and payment_timestamp.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT payment_id,\n guest_id,\n amount,\n payment_timestamp\nFROM hospitality_technology.payme... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number text, email text, hospital_affiliation_id text, created_at timestamp, updated_at timestamp )
| [
{
"role": "user",
"content": "Count the total number of distinct specialties listed in the doctors table.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT count(DISTINCT specialty) FROM healthcare.doctors;",
"sql": null
},
{
"role": "user",
"content": "Show the lice... |
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.text, agency_id.text, first_name.text, last_name.text, job_title.text, department.text, work_email.text, work_phone.text, hire_date.date, termination_date.date, access_level.text, manager_employee_id.text )
| [
{
"role": "user",
"content": "For each access level, count the number of employees. Return access_level and the corresponding employee_count.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT access_level, COUNT(*) AS employee_count FROM government_services.employees GROUP BY access... |
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, model text, year integer, type text, capacity integer, fuel_type text, status text, depot_id text, acquisition_date date )
CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, license_expiry_date date, contact_number text, email text, hire_date date, status text )
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes integer, type text )
CREATE TABLE transportation.trips ( trip_id text, route_id text, vehicle_id text, driver_id text, scheduled_departure timestamp, actual_departure timestamp, scheduled_arrival timestamp, actual_arrival timestamp, origin_location_id text, destination_location_id text, status text, passenger_count integer, cargo_manifest_id text )
CREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )
CREATE TABLE transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_type text, description text, cost numeric, mechanic_name text, next_service_due_date date )
CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, quantity numeric, unit text, cost_per_unit numeric, total_cost numeric, odometer_reading integer, location_id text )
CREATE TABLE transportation.passengers ( passenger_id text, first_name text, last_name text, email text, phone_number text, date_of_birth date, loyalty_program_id text, created_at timestamp )
| [
{
"role": "user",
"content": "Show me all trips along with the city name of their origin and the scheduled departure time.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT t.trip_id, l.name AS origin_city, t.scheduled_departure\nFROM transportation.trips t\nJOIN transportation.loca... |
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, -- unique identifier for the claim
policy_id character varying(64) NOT NULL, -- identifier of the policy under which the claim is made (FK to policies)
customer_id character varying(64) NOT NULL, -- identifier of the customer making the claim (FK to customers)
incident_date timestamp NOT NULL, -- date and time of the incident leading to the claim
reported_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- date the claim was reported
description text NOT NULL, -- detailed description of the incident and claim
estimated_loss numeric(15, 2), -- initial estimated cost of the loss
status character varying(30) NOT NULL, -- e.g., Filed, Processing, Under Review, Approved, Denied, Settled
settlement_amount numeric(15, 2), -- final amount paid out
settlement_date date,
claim_handler_id character varying(64), -- identifier for the employee handling the claim (FK to employees/adjusters)
police_report_number character varying(100),
PRIMARY KEY (claim_id)
)
| [
{
"role": "user",
"content": "Show the number of claims filed for each distinct status, ordered by the count in descending order.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS claim_count\nFROM insurance.claims\nGROUP BY status\nORDER BY claim_count DESC;",
... |
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 6