system stringlengths 323 8.06k | conversations listlengths 6 56 |
|---|---|
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
CREATE TABLE trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
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.trades ( trade_id text PRIMARY KEY, order_id text, buyer_id text, seller_id text, asset_id text, quantity numeric, price numeric, traded_at timestamp )
CREATE TABLE trading_platform.utxos ( utxo_id text PRIMARY KEY, transaction_id text, output_index int, address text, amount numeric, spent boolean )
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": "Show me each completed order with order_id, the username of the user who placed it, asset_id, quantity, and price.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT\n o.order_id,\n u.username,\n o.asset_id,\n o.quantity,\n o.price\nFROM trading_pla... |
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.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, service_date date NOT NULL, odometer_reading integer, service_type character varying(128) NOT NULL, description text NOT NULL, cost numeric(10, 2), mechanic_name character varying(128), next_service_due_date date, PRIMARY KEY (log_id) )
| [
{
"role": "user",
"content": "Find pairs of consecutive maintenance logs for the same vehicle based on service date. Show the vehicle ID, log IDs, service dates, and odometer readings for both logs in each pair.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT vehicle_id, log_id, s... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE 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 government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_email text, main_phone_number text, website_url text, established_date date, parent_agency_id text )
CREATE TABLE government_services.service_locations ( location_id text PRIMARY KEY, agency_id text, location_name text, address text, city text, state text, postal_code text, latitude numeric, longitude numeric, operating_hours text, contact_phone text, is_accessible boolean )
CREATE TABLE government_services.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_subject text, message_body text, channel text, sent_at timestamp, status text, related_entity_type text, related_entity_id text )
| [
{
"role": "user",
"content": "Provide the message_subject and agency_name for all notifications that are related to agencies and have a status of 'Sent'.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT n.message_subject, a.agency_name\nFROM government_services.notifications n\nJOI... |
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.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, main_phone_number.text, website_url.text, established_date.date, parent_agency_id.text )
| [
{
"role": "user",
"content": "Can you list the names of agencies that do not have a parent agency assigned, ordered by their established date?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT agency_id, agency_name, established_date\nFROM government_services.agencies\nWHERE parent_... |
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.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, item_id uuid NOT NULL, quantity integer NOT NULL DEFAULT 1, acquired_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, instance_data jsonb, PRIMARY KEY (inventory_id) )
| [
{
"role": "user",
"content": "Show me, for each item, the total number of times it has been acquired and the earliest date it was acquired. Also, show the number of unique players who have acquired each item.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT item_id, COUNT(*) AS tot... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE financial_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the employee
first_name character varying(100) NOT NULL,
last_name character varying(100) NOT NULL,
job_title character varying(100) NOT NULL, -- e.g., Teller, Branch Manager, Financial Advisor, Analyst
department character varying(100), -- e.g., Retail Banking, Wealth Management, IT
branch_id character varying(64), -- Identifier for the branch they work at (if applicable)
email character varying(128) NOT NULL UNIQUE,
phone_extension character varying(20),
hire_date date NOT NULL,
termination_date date, -- Date of termination, null if currently employed
manager_id character varying(64), -- Self-referencing key for manager relationship
status character varying(32) NOT NULL, -- e.g., Active, Terminated, On Leave
PRIMARY KEY (employee_id),
FOREIGN KEY (branch_id) REFERENCES financial_services.branches(branch_id), -- Assuming a branches table exists
FOREIGN KEY (manager_id) REFERENCES financial_services.employees(employee_id)
)
| [
{
"role": "user",
"content": "List employees whose job title is different from their manager's job title, showing the employee's full name and their manager's full name.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, m.first_name AS manager_first_name, ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position text, work_email text, work_phone text, hire_date date, termination_date date, is_active boolean, access_level int, manager_id text, created_at timestamp )
CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, service_name character varying(150) NOT NULL, description text, category character varying(100), price numeric(10, 2) NOT NULL, unit character varying(30), is_available boolean NOT NULL DEFAULT true, department character varying(100), PRIMARY KEY (service_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id) )
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 )
CREATE TABLE hospitality_technology.reviews ( review_id text PRIMARY KEY, property_id text, reservation_id text, guest_id text, rating_overall int, rating_cleanliness int, rating_service int, rating_location int, rating_value int, comment text, review_source text, review_date timestamp, is_public boolean, staff_response text, response_staff_id text, response_date timestamp )
| [
{
"role": "user",
"content": "List staff members who responded to public reviews with an overall rating of 3 or less. Include the staff member's first name, last name, and the review ID.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.review_id FROM... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, 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.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, status.text, fare.numeric, payment_transaction_id.text, special_requests.text )
| [
{
"role": "user",
"content": "Could you provide the booking ID, route number, and fare for all bookings?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT T1.booking_id, T2.route_number, T1.fare FROM transportation.bookings AS T1 JOIN transportation.routes AS T2 ON T1.trip_id = T2.r... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
title character varying(200) NOT NULL, -- official title of the game
developer_id uuid NOT NULL, -- FK linking to the developers table
publisher_id uuid, -- FK linking to a potential publishers table (optional)
genre character varying(100), -- primary genre (e.g., RPG, FPS, Strategy)
release_date date, -- official release date
description text, -- short description or synopsis of the game
platform character varying(50) NOT NULL, -- primary platform (e.g., PC, PlayStation 5, Xbox Series X, Mobile)
engine character varying(100), -- game engine used (e.g., Unreal Engine 5, Unity)
website character varying(255), -- official website URL
PRIMARY KEY (game_id)
-- FOREIGN KEY (developer_id) REFERENCES gaming_technology.developers(developer_id) -- Example FK constraint
)
| [
{
"role": "user",
"content": "List each genre and the number of games in that genre.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT genre,\n COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY genre;",
"sql": null
},
{
"role": "user",
"content": "... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, category text, eligibility_criteria text, standard_fee numeric, average_processing_time_days int, is_active boolean, online_application_url text )
| [
{
"role": "user",
"content": "What is the average and maximum standard fee for services in each category?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT category, AVG(standard_fee) AS avg_standard_fee, MAX(standard_fee) AS max_standard_fee FROM government_services.services GROUP ... |
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.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable service
property_id character varying(64) NOT NULL, -- FK to properties table
service_name character varying(150) NOT NULL, -- e.g., Room Service - Burger, Spa - Massage 60min, Laundry - Shirt
description text,
category character varying(100), -- e.g., Food & Beverage, Wellness, Business Center, Activities
price numeric(10, 2) NOT NULL, -- price per unit/instance
unit character varying(30), -- e.g., Per Item, Per Hour, Per Day
is_available boolean NOT NULL DEFAULT true, -- is the service currently offered?
department character varying(100), -- department responsible (e.g., F&B, Spa, Housekeeping)
PRIMARY KEY (service_id),
FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id)
)
| [
{
"role": "user",
"content": "For each property, show the property name, average price of available services, and the maximum price of available services.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n AVG(s.price) AS avg_price,\n MAX(s.price) AS ma... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url text, bio text, location text, created_at timestamp, updated_at timestamp, is_verified boolean )
CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at timestamp, updated_at timestamp, visibility text, location_lat numeric, location_lon numeric )
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.timestamp, updated_at.timestamp )
CREATE TABLE social_media.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
CREATE TABLE social_media.hashtags ( hashtag_id.text, tag_name.text, created_at.timestamp )
CREATE TABLE social_media.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text )
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.notifications ( notification_id character varying(64) NOT NULL, recipient_user_id character varying(64) NOT NULL, sender_user_id character varying(64), notification_type character varying(30) NOT NULL, target_entity_id character varying(64), target_entity_type character varying(20), created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, read_at timestamp, PRIMARY KEY (notification_id) )
CREATE TABLE social_media.user_settings ( setting_id text PRIMARY KEY, user_id text, theme text, email_notifications_enabled bool, push_notifications_enabled bool, private_profile bool, updated_at timestamp )
| [
{
"role": "user",
"content": "List usernames and email addresses of users who have enabled both email and push notifications.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT T1.username, T1.email FROM social_media.users AS T1 INNER JOIN social_media.user_settings AS T2 ON T1.user_... |
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, model_name text, manufacturer text, passenger_capacity integer, max_range_km integer, engine_type text, wingspan_m numeric, status text, first_flight_date date )
| [
{
"role": "user",
"content": "What are the safety ratings or crash statistics for the Boeing 787 Dreamliner?",
"sql": null
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to safety ratings or crash statistics for specific aircraft models like the Boeing 787 Dreamline... |
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 varying(32) NOT NULL, project_name character varying(128) NOT NULL, rounds_name character varying(32), investment_value numeric(38,14), investment_date character varying(128), introduction character varying(128), valuation numeric(38,14) )
CREATE TABLE narrative_info ( narrative character varying(512) NOT NULL, top_3_coins text, price_change_percentage_1h double precision, price_change_percentage_24h double precision, price_change_percentage_7d double precision, market_cap double precision, volume_24h double precision, trend_rank bigint, token_num bigint )
CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, token_name character varying(100) NOT NULL, token_symbol character varying(100) NOT NULL, chain text, price double precision, price_change_percentage_1h double precision, price_change_percentage_6h double precision, price_change_percentage_24h double precision, makers_24h double precision, volume_24h double precision, liquidity double precision, market_cap double precision, trend_rank bigint )
CREATE TABLE cex_token_balance ( snapshot_time character varying(32) NOT NULL, chain character varying(128) NOT NULL, address character varying(128) NOT NULL, exchange character varying(512) NOT NULL, token_address character varying(128) NOT NULL, token_symbol character varying(512), balance numeric(38,10), usd_value numeric(38,14), price double precision )
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl numeric(38,2), net_flow numeric(38,2), avg_cost numeric(38,16), price double precision, realized_ratio numeric(10,2), roi numeric(10,2), chain character varying(100) )
| [
{
"role": "user",
"content": "Which projects had fundraising rounds named 'Series A' in 2022, and what are their token symbols and current token prices from DEX pools?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT p.project_name, p.rounds_name, d.token_symbol, d.price\nFROM proj... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNIQUE, phone text, address text, date_registered timestamp, status text )
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, phone.text, specialization.text, hire_date.timestamp, is_partner.boolean )
CREATE TABLE legal_services.law_firms ( firm_id.text, firm_name.text, address.text, phone.text, website.text, founded_date.date, managing_partner_id.text )
CREATE TABLE legal_services.cases (
case_id character varying(64) NOT NULL, -- unique identifier for the case/matter
case_number character varying(100) UNIQUE, -- official case number (court or internal)
case_name text NOT NULL, -- descriptive name or title for the case
client_id character varying(64) NOT NULL, -- FK to clients table
lead_lawyer_id character varying(64) NOT NULL, -- FK to lawyers table (primary lawyer responsible)
case_type character varying(100) NOT NULL, -- e.g., Litigation, Corporate, Family Law, IP
status character varying(50) NOT NULL, -- e.g., Open, Closed, Pending, On Hold, Appealed
date_opened timestamp NOT NULL, -- date the case was formally opened
date_closed timestamp, -- date the case was closed (nullable)
description text, -- detailed description of the case
court_jurisdiction character varying(128), -- court or jurisdiction if applicable
PRIMARY KEY (case_id)
)
CREATE TABLE legal_services.documents ( document_id text PRIMARY KEY, case_id text, document_name text, document_type text, storage_path text, uploaded_by_lawyer_id text, upload_timestamp timestamp, version int, description text )
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invoice_number character varying(100) UNIQUE NOT NULL, -- user-facing invoice number
client_id character varying(64) NOT NULL, -- FK to clients table
case_id character varying(64), -- FK to cases table (optional, could be general retainer)
issue_date date NOT NULL, -- date the invoice was generated
due_date date NOT NULL, -- date the payment is due
total_amount numeric(12, 2) NOT NULL, -- total amount due on the invoice
amount_paid numeric(12, 2) DEFAULT 0.00, -- amount already paid
status character varying(50) NOT NULL, -- e.g., Draft, Sent, Paid, Partially Paid, Overdue, Void
payment_date timestamp, -- date the invoice was fully paid (nullable)
notes text, -- additional notes or terms on the invoice
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (invoice_id)
)
CREATE TABLE legal_services.appointments (
appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment
client_id character varying(64) NOT NULL, -- FK to clients table
lawyer_id character varying(64) NOT NULL, -- FK to lawyers table
case_id character varying(64), -- FK to cases table (optional, if related to a specific case)
start_time timestamp NOT NULL, -- scheduled start date and time
end_time timestamp NOT NULL, -- scheduled end date and time
location text, -- location of the meeting (address or virtual link)
subject character varying(255), -- subject or purpose of the appointment
notes text, -- additional notes for the appointment
status character varying(50) NOT NULL, -- e.g., Scheduled, Completed, Canceled, Rescheduled
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (appointment_id)
)
| [
{
"role": "user",
"content": "List all documents along with the document type and the case name they are associated with.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT d.document_name, d.document_type, c.case_name\nFROM legal_services.documents d\nJOIN legal_services.cases c ON ... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
property_id character varying(64) NOT NULL, -- FK to properties table
room_number character varying(10) NOT NULL, -- room number identifier (e.g., '101', 'Suite 2B')
room_type_id character varying(64) NOT NULL, -- FK to room_types table
floor integer, -- floor number the room is on
status character varying(50) NOT NULL, -- e.g., Available, Occupied, Cleaning, OutOfOrder, Maintenance
is_smoking boolean NOT NULL DEFAULT false, -- smoking allowed flag
features text, -- description of features (e.g., Balcony, Sea View, Jacuzzi)
current_condition text, -- notes on room condition
last_cleaned_at timestamp with time zone, -- timestamp of last cleaning
PRIMARY KEY (room_id),
FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id),
FOREIGN KEY (room_type_id) REFERENCES hospitality_technology.room_types(room_type_id)
)
| [
{
"role": "user",
"content": "List all room numbers, their type names, and base rates for rooms located on floor 5.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T2.type_name, T2.base_rate FROM hospitality_technology.rooms AS T1 JOIN hospitality_technology.room_t... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// PUT /schedules
{
"mappings": {
"properties": {
"schedule_id": { "type": "keyword" },
"train_id": { "type": "keyword" }, // References trains index
"route_id": { "type": "keyword" }, // References routes index
"departure_datetime": { "type": "date" }, // ISO 8601 format recommended
"arrival_datetime": { "type": "date" },
"status": { "type": "keyword" },
"notes": { "type": "text" }
}
}
}
// PUT /passengers
{
"mappings": {
"properties": {
"passenger_id": { "type": "keyword" },
"first_name": {
"type": "text",
"fields": { "keyword": { "type": "keyword", "ignore_above": 100 } }
},
"last_name": {
"type": "text",
"fields": { "keyword": { "type": "keyword", "ignore_above": 100 } }
},
"email": { "type": "keyword" }, // Often used for exact matches
"phone_number": { "type": "keyword" },
"date_of_birth": { "type": "date", "format": "yyyy-MM-dd" },
"loyalty_program_id": { "type": "keyword" },
"created_at": { "type": "date" }
}
}
}
| [
{
"role": "user",
"content": "能否帮我查询特定列车行程(schedule_id 为 'sched_001')的详细信息,包括列车出发和到达时间,以及该行程所属路线的ID和相关乘客信息?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT s.schedule_id, s.train_id, s.route_id, s.departure_datetime, s.arrival_datetime, s.status, p.passenger_id, p.first_name, p.la... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_at timestamp with time zone )
CREATE TABLE gaming_technology.game_sessions (
session_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game session
player_id uuid NOT NULL, -- FK linking to the players table
game_id uuid NOT NULL, -- FK linking to the games table
server_id uuid, -- FK linking to the servers table (nullable for single-player)
start_time timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, -- when the session began
end_time timestamp with time zone, -- when the session ended (null if ongoing)
duration_seconds integer, -- calculated duration of the session in seconds
score integer, -- player's score for the session, if applicable
session_data jsonb, -- flexible field for session-specific info (e.g., map played, character used)
PRIMARY KEY (session_id)
-- FOREIGN KEY (player_id) REFERENCES gaming_technology.players(player_id),
-- FOREIGN KEY (game_id) REFERENCES gaming_technology.games(game_id),
-- FOREIGN KEY (server_id) REFERENCES gaming_technology.servers(server_id)
)
CREATE TABLE gaming_technology.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name character varying(150), region character varying(50) NOT NULL, ip_address character varying(45), port integer, current_players integer NOT NULL DEFAULT 0, max_players integer NOT NULL, status character varying(30) NOT NULL DEFAULT 'offline', last_heartbeat timestamp with time zone, PRIMARY KEY (server_id) )
CREATE TABLE gaming_technology.achievements ( achievement_id uuid, game_id uuid, name text, description text, icon_url text, points integer, hidden boolean )
CREATE TABLE gaming_technology.in_game_items ( item_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, item_name character varying(150) NOT NULL, item_type character varying(50) NOT NULL, description text, rarity character varying(30), cost_currency character varying(10), cost_amount numeric(12, 2), attributes jsonb, PRIMARY KEY (item_id) )
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquired_at timestamptz, instance_data jsonb )
| [
{
"role": "user",
"content": "Show the total number of game sessions played on each server that is currently 'online'. Include the server name, region, and the count of sessions.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, COUNT(gs.session_id) AS total... |
You are an expert in writing database language and you can refuse the user's question if the question is not related to the table structure. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE train_station_management.staff ( staff_id text PRIMARY KEY, first_name text, last_name text, role text, primary_station_id text, employee_number text UNIQUE, hire_date date, contact_email text UNIQUE, contact_phone text, is_active boolean )
| [
{
"role": "user",
"content": "What are the training programs or certifications completed by a staff member with the role of Platform Supervisor?",
"sql": null
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to information about the training programs or certifications... |
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes integer, type text )
| [
{
"role": "user",
"content": "Find all pairs of different routes where the estimated duration in minutes is identical. For each pair, show both route IDs, their route numbers, and the shared duration.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT r1.route_id AS route1_id, r1.rou... |
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_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol character varying(100) NOT NULL, token_address character varying(100) NOT NULL, chain text, price double precision, price_change_percentage_1h double precision, price_change_percentage_24h double precision, price_change_percentage_7d double precision, highest_price_24h double precision, lowest_price_24h double precision, market_cap double precision, market_cap_rank bigint, market_cap_change_percentage_24h text, total_volume text, narrative text, trend_rank bigint )
| [
{
"role": "user",
"content": "List all tokens with a price below $1 and a 24-hour trading volume over $5 million.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE price < 1 AND total_volume::numeric > 5000000... |
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 narrative_info (",
"narrative character varying(512) NOT NULL, -- the id of narrative",
"top_3_coins text, -- the top 3 tokens in the narrative",
"price_change_percentage_1h double precision, -- change in value divided by the absolute price value of the original token price in 1 hour in the narrative",
"price_change_percentage_24h double precision, -- change in value divided by the absolute price value of the original token price in 24 hours in the narrative",
"price_change_percentage_7d double precision, -- change in value divided by the absolute price value of the original token price in 7 days in the narrative",
"market_cap double precision, -- the market cap of the narrative",
"volume_24h double precision, -- the trade volume of the narrative",
"trend_rank bigint, -- the trending rank of the narrative, value 1 expresses the most popular narrative",
"token_num bigint, -- total token number in the narrative",
",PRIMARY KEY (narrative));"
"CREATE TABLE cex_token_balance (",
"snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted from original timestamp",
"chain character varying(128) NOT NULL, -- the chain that the token resides",
"address character varying(128) NOT NULL, -- the address that holds the assets, owned by a CEX",
"exchange character varying(512) NOT NULL, -- a centralized exchange name",
"token_address character varying(128) NOT NULL, -- token contract address",
"token_symbol character varying(512), --token symbol",
"balance numeric(38,10), -- token balance",
"usd_value numeric(38,14), -- value of the token held in USD",
"price double precision, --price of the token in USD",
",PRIMARY KEY (snapshot_time, exchange, address, chain, token_address));"
"CREATE TABLE smart_money_profit (",
"address character varying(100) NOT NULL, -- the user's address",
"rank INT, -- the rank of the address in trade performance, value 1 expresses the best address.",
"profit numeric(38,6), -- the profit user made in a month",
"roi numeric(38,2), -- the roi of the user in a month",
"realized_ratio numeric(38,2), -- the percentage of the user's realized profit",
"most_profit_token character varying(100), -- the token symbol of the user's most profitable trade",
"last_trade_time character varying(100), -- the last trade time of the user",
"chain character varying(100), -- the chain that the address resides",
"PRIMARY KEY (address, chain));",
"CREATE TABLE smart_money_token_inflow (",
"token_address character varying(100) NOT NULL, -- the token's address",
"token_symbol character varying(100), -- the tokens's symbol",
"token_amount numeric(38,2), -- the absolute value of the amount if user bought minus the amount user sold of this token",
"usd_value numeric(38,2), -- the absolute usd value of the bought token minus sold token",
"avg_price numeric(38,6), -- the average cost price of user spent on this token",
"type int, -- the direction of the trade on this token. 1 means buying, 2 means selling",
"address_amount integer, -- the amount of the user bought this token",
"narrative character varying(100), -- the category or narrative of the token",
"chain character varying(100), -- the chain that the token resides",
",PRIMARY KEY (token_address, chain)",
| [
{
"role": "user",
"content": "Which smart money address on the 'Ethereum' chain has the highest profit from tokens in the 'DeFi' narrative, and what is their ROI?",
"sql": null
},
{
"role": "assistant",
"content": "SELECT sm.address, sm.profit, sm.roi\nFROM smart_money_profit sm\nJOIN smart_... |
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 train_station_management.stations ( station_id text, station_name text, city text, state_province text, country_code text, address text, timezone text, number_of_platforms integer, created_at timestamp, last_updated_at timestamp )
| [
{
"role": "user",
"content": "What is the schedule of trains arriving at station with ID 'ST789' tomorrow?",
"sql": null
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide the train schedule for station ID 'ST789' as this information is not available in the current database... |
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.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billing_rate numeric, description text, is_billable bool, is_billed bool, invoice_id text, created_at timestamp )
| [
{
"role": "user",
"content": "List all time entries that do not have a description, including the entry ID, date worked, hours spent, and the first and last name of the lawyer who recorded the entry.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT te.entry_id, te.date_worked, te.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.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id character varying(64) NOT NULL, -- identifier for the policyholder (FK to customers)
product_id character varying(64) NOT NULL, -- identifier for the insurance product (FK to insurance_products)
agent_id character varying(64), -- identifier for the agent who sold the policy (FK to agents)
policy_number character varying(100) NOT NULL UNIQUE, -- customer-facing policy number
start_date date NOT NULL, -- date the policy coverage begins
end_date date NOT NULL, -- date the policy coverage ends
premium_amount numeric(12, 2) NOT NULL, -- total premium for the policy term
coverage_limit numeric(15, 2) NOT NULL, -- maximum amount covered
deductible numeric(10, 2) NOT NULL, -- amount customer pays before coverage kicks in
status character varying(30) NOT NULL, -- e.g., Active, Expired, Cancelled, Pending
issued_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- when the policy was issued
cancellation_date date,
cancellation_reason text,
PRIMARY KEY (policy_id)
)
| [
{
"role": "user",
"content": "Which customers have more than one active policy at the same time? Show the customer ID and the number of active policies.",
"sql": null
},
{
"role": "assistant",
"content": "SELECT customer_id, COUNT(policy_id) AS active_policy_count\nFROM insurance.policies\nW... |
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 6