KDB.AI Naming Conventions and Reserved Words

This page provides details on the naming rules and reserved words used within KDB.AI tables. It includes guidelines for naming databases, tables, and columns, as well as a comprehensive list of reserved words to avoid.

Adhering to proper naming conventions is crucial for maintaining clear and error-free code. This guide outlines the KDB.AI naming rules and reserved words to help you avoid syntax errors, unpredictable behavior, and unclear code.

Naming rules

When naming databases, tables, or columns created in KDB.AI, adhere to the following rules to ensure compatibility and avoid issues:

  • Max length: 128 characters.
  • Allowed characters: only alphanumeric characters and underscores
  • Starting character: must start with an alpha character (any letter from A-Z or a-z)
  • Reserved words: do not use reserved words for KDB.AI-managed entities. Refer to the [Reserved words](link) section for more details.

Reserved words

KDB.AI uses reserved words, such as keywords and primitive function names.

  • For tables created and managed in KDB.AI: you should not use reserved words in database names, table names, and column names.

  • For external kdb+ tables: there is no constraint on names. However, using reserved words in table column names or table names can lead to syntax errors, unexpected behavior, or code ambiguity, potentially shadowing built-in functionality.

List of reserved words

Below is a list of reserved words in KDB.AI:

A – CE CO – EM EN – HD HE – LO LS – NE NO – RE RL – SU SU – VI VS – X
abs cols enlist hopen lsq not rload sums vs
acos cor eval hsym ltime null rotate sv wavg
aj cos except iasc ltrim or rsave svar where
aj0 count exec idesc mavg over rtrim system while
ajf cov exit if max parse save tables within
ajf0 cross exp ij maxs peach scan tan wj
all csv fby ijf mcount pj scov til wj1
and cut fills in md5 prd sdev trim wsum
any delete first insert mdev prds select type ww
asc deltas fkeys inter med prev set uj xasc
asin desc flip inv meta prior setenv ujf xbar
asof dev floor key min rand show ungroup xcol
atan differ from keys mins rank signum union xcols
attr distinct get last mmax ratios sin update xdesc
avg div getenv like mmin raze sqrt upper xexp
avgs do group lj mmu read0 ss upsert xgroup
bin dsave gtime ljf mod read1 ssr value xkey
binr each hclose load msum reciprocal string var xlog
by ej hcount log neg reval sublist view xprev
ceiling ema hdel lower next reverse sum views xrank

Best practices

  • Avoid reserved words: do not use reserved words as names for databases, tables, or columns.
  • Use descriptive names: choose descriptive and meaningful names that do not conflict with reserved words.
  • Check for conflicts: before finalizing names, check if they conflict with any reserved words to prevent issues.
  • Start with an alpha character: ensure names start with a letter from the alphabet (A-Z or a-z).
  • Avoid special characters: use only alphanumeric characters and underscores in names.

Examples

Valid names:

customer_data
sales_report_2025
transaction_id

Invalid names:

select (reserved word)
123data (starts with a number)
customer-data (contains a hyphen)
_transaction (starts with an underscore)

Conclusion

Adhering to these naming guidelines will help you avoid syntax errors, unexpected behavior, and code ambiguity.

By choosing appropriate names for your databases, tables, and columns, you can ensure that your code remains clear and maintainable.