SQL Reserved Words

SarahLSarahL Administrator, Moderator, Employee, Registered User, VerticaExpert, CABuser

Jim Knicely authored this tip.

Keywords are words that have a specific meaning in the SQL language. Every SQL statement contains one or more keywords. Many keywords are also reserved words. Vertica recommends that you not use reserved words as names for objects, or as identifiers. Including reserved words can make your SQL statements confusing.

You can query the V_CATALOG.STANDARD_KEYWORDS system table to find the list of Vertica SQL reserved words.

Example:

dbadmin=> SELECT *FROM v_catalog.standard_keywords WHERE reserved = 'R' ORDER BY standard_version DESC LIMIT 1;
 keyword | standard_version | reserved
---------+------------------+----------
ABS     |             2011 | R
(1 row)

Notice how the number of reserved words increases by ANSI SQL version:

dbadmin=> SELECT standard_version, COUNT(*) reserved_word_cnt FROM v_catalog.standard_keywords WHERE reserved = 'R' GROUP BY standard_version ORDER BY 1;
 standard_version | reserved_word_cnt
------------------+-------------------
              1992 |               227
              2003 |               288
              2008 |               298
              2011 |               357
(4 rows)

Have Fun!

Sign In or Register to comment.