SQL

Reserved Words

A reserved word is a token that Metaform's SQL parser recognizes as part of the language grammar (e.g., SELECT, WHERE, JOIN, DATE, RANK, TABLES). If you use a reserved word as a schema name, table name, column name, alias, or workspace name without quoting, your query may fail or, worse, be parsed in an unintended way.

In Metaform, you quote identifiers with backticks ("like_this "). Backticks are used both for classic SQL keywords and for file paths or directory names that include characters SQL can't normally parse.


How Metaform treats identifiers (and why backticks matter)

Metaform follows ANSI SQL but extends the lexical rules for working with non-relational sources. Quoted identifiers disambiguate names from keywords and allow characters that would otherwise be illegal. Metaform uses backticks, not double quotes, for quoted identifiers.

A few important consequences:

  • Keywords that are also common column names (such as date, rank, last, default, tables) need backticks when used as identifiers.
  • File paths and workspaces frequently require quoting—especially default workspaces or paths with /.

Working categories of reserved words

Rather than memorize an alphabet soup, it helps to group reserved words by how you encounter them in everyday queries.

Query clauses & set operators

Purpose: Core SELECT grammar and result shaping.

Common examples: SELECT, FROM, WHERE, GROUP, HAVING, ORDER, LIMIT, OFFSET, JOIN, UNION, INTERSECT, EXCEPT, WITH.

Tip: Column aliases that collide with these (e.g., calling a column group or order) must be backticked.

Data definition, catalog & session control

Purpose: Create/alter/drop objects; navigate catalogs; manipulate session settings.

Common examples: CREATE, DROP, ALTER, DESCRIBE, SHOW, USE, SET, RESET, EXPLAIN, ANALYZE, REFRESH.

SHOW TABLES, SHOW SCHEMAS, and USE are part of Metaform's supported commands; names like TABLES and SCHEMAS are reserved and sometimes appear in metadata queries.

Types, literals & predicates

Purpose: Data typing, literal values, and boolean logic.

Common examples: BOOLEAN, TINYINT, INT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL, NUMERIC, DATE, TIME, TIMESTAMP, INTERVAL, NULL, TRUE, FALSE, plus predicates like IN, IS, LIKE, BETWEEN, SIMILAR.

Expressions & conditionals

Purpose: Scalar expression building and case analysis.

Common examples: CASE, WHEN, THEN, ELSE, END, CAST, COALESCE, EXTRACT, POSITION, SUBSTRING.

Analytic/window functions & framing

Purpose: Ranking, row comparisons, and frame definitions.

Common examples: OVER, PARTITION, ORDER, ROWS, RANGE, RANK, DENSE_RANK, NTILE, LAG, LEAD, FIRST_VALUE, LAST_VALUE, ROW_NUMBER.

Metadata touchpoints

Purpose: Words you’ll hit when querying system metadata.

Common examples: TABLES, COLUMNS in INFORMATION_SCHEMA; SCHEMAS; SHOW TABLES; FILES when browsing storage.


Quoting paths and directories

If your table reference is actually a file or directory path, quote the parts that include slashes or reserved words.

SELECT *
FROM local.`default`.`people.csv`;

Naming guidelines and best practices

  1. Prefer safe, descriptive names (e.g., order_id instead of order, rank_value instead of rank).
  2. Be consistent with quoting—if a dataset arrives with risky names, normalize them with views or CTAS:
CREATE OR REPLACE VIEW local.tmp.people AS
SELECT `order` AS order_col, `date` AS event_date, *
FROM local.tmp.`events.json`;
  1. Quote system-metadata identifiers such as INFORMATION_SCHEMA.TABLES or `sys.`profiles when needed.
  2. Assume portability costs—Metaform uses backticks; other SQL engines prefer double quotes or brackets. If you move queries between systems, standardize naming early.

Quick checklist (when a query fails to parse)

  • Does the identifier equal a reserved word? Try backticks.
  • Are you referencing a workspace like default or a path with slashes? Quote it.
  • Are you querying system metadata like INFORMATION_SCHEMA.TABLES? Quote TABLES.
  • Is your column name the same as a built-in function (e.g., count, rank, date)? Quote it (and consider renaming/aliasing).