title: Grammar Reference sidebar_label: Grammar Reference

{/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */}

This section describes grammar elements that are common to multiple SQL functions (DDL, Distribution Zones, etc.).

assign

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

  • identifier - the name of table, column or other element that will be updated by the operation.
  • expression - a valid SQL expression that returns the values that must be assigned to the identifier.

Referenced by:

  • MERGE
  • UPDATE

column_definition

{/* Railroad diagram omitted - see 3.1.0 docs */}

{/* Railroad diagram omitted - see 3.1.0 docs */}

Keywords and parameters:

  • column_name - a column name.

  • DATA TYPE - the data type allowed in the column.

  • identifier - the random identifier for the row. Can be generated by using the RAND_UUID function.

  • literal_value - a value to be assigned as default.

  • CURRENT_TIMESTAMP - the function that returns current time. Can only be used for TIMESTAMP WITH LOCAL TIME ZONE columns.

  • interval - the time interval by which the timestamp will be offset. Required if CURRENT_TIMESTAMP is used. The interval can be specified in:

    • SECONDS
    • MINUTES
    • HOURS
    • DAYS
    • MONTHS

    If the interval is 0, current time is used.

Referenced by:

column_definition_or_list

{/* Railroad diagram omitted - see 3.1.0 docs */}

Keywords and parameters:

  • column_name - a column name.
  • data_type - a valid data type.

Referenced by:

column_list

{/* Railroad diagram omitted - see 3.1.0 docs */}

Keywords and parameters:

  • column_name - a column name.

Referenced by:

column_name_or_list

{/* Railroad diagram omitted - see 3.1.0 docs */}

Keywords and parameters:

  • column_name - a column name.

Referenced by:

constraint

{/* Railroad diagram omitted - see 3.1.0 docs */}

Keywords and parameters:

  • constraint_name - a name of the constraint.

Referenced by:

group_item

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

  • expression - a valid SQL expression that returns the values that must be assigned to the identifier.

Referenced by:

join_condition

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

  • boolean_expression - an SQL expression that returns a boolean value. Only the records for which TRUE was returned will be returned. If not specified, all matching records are returned.

Referenced by:

order_item

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

  • expression - a valid SQL expression that denotes the specific item in the SELECT clause.

Referenced by:

parameter

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters:

  • parameter_name - the name of the parameter.
  • parameter_value - the value of the parameter.

When a parameter is specified, you can provide it as a literal value or as an identifier. For example:

CREATE ZONE test_zone;
CREATE TABLE test_table (id INT PRIMARY KEY, val INT) WITH PRIMARY_ZONE=test_zone;

In this case, test_zone is the identifier, and is used as an identifier. When used like this, the parameters are not case-sensitive.

CREATE ZONE "test_zone";
CREATE TABLE test_table (id INT PRIMARY KEY, val INT) WITH PRIMARY_ZONE='test_zone';

In this case, test_zone is created as a literal value, and is used as a literal. When used like this, the parameter is case-sensitive.

CREATE ZONE test_zone;
CREATE TABLE test_table (id INT PRIMARY KEY, val INT) WITH PRIMARY_ZONE=`TEST_ZONE`;

In this case, test_zone is created as an identifier, and is case-insensitive. As such, when TEST_ZONE is used as a literal, it still matches the identifier.

Referenced by:

project_item

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

  • expression - a valid SQL expression that denotes the specific item in the SELECT clause.
  • table_alias - a qualified table alias to use.

Referenced by:

qualified_table_name

{/* Railroad diagram omitted - see 3.1.0 docs */}

Keywords and parameters:

  • schema - a name of the table schema.
  • table_name - a name of the table.

Referenced by:

query

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

  • expression - a valid SQL expression.
  • start - the number of result to start the query from.
  • count - the number of values to fetch.

Referenced by:

select_without_from

{/* Railroad diagram omitted - see 3.1.0 docs */}

Referenced by:

sorted_column_list

{/* Railroad diagram omitted - see 3.1.0 docs */}

Keywords and parameters:

  • column_name - a column name.
  • NULLS FIRST - if specified, places any NULL values before all non-NULL in that column's ordering.
  • NULLS LAST - if specified, places NULLs after all non-NULLs in that column's ordering.

Referenced by:

table_expression

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

Referenced by:

table_primary

{/* Railroad diagram omitted - see 3.1.0 docs */}

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

Referenced by:

table_reference

{/* Railroad diagram omitted - see 3.1.0 docs */}

Parameters

  • alias - the alias that will be used for the table.
  • column_alias - the alias used for column.

Referenced by:

with_item

{/* Railroad diagram omitted - see 3.1.0 docs */}

Referenced by: