CREATE TABLE CLONE

Grammar syntax

CREATE TABLE [ IF NOT EXISTS ]
destination_table_name
CLONE source_table_name [FOR SYSTEM_TIME AS OF time_expression]
...
[OPTIONS(table_option_list)]

Sample Source Patterns

FOR SYSTEM TIME AS OF

Input Code:

IN -> BigQuery_01.sql
CREATE TABLE my_clone_table
CLONE some_table_name2
FOR SYSTEM_TIME AS OF TIMESTAMP "2025-01-01 00:00:00 UTC";

Outpur Code:

OUT -> BigQuery_01.sql
CREATE TABLE my_clone_table
CLONE some_table_name2 AT (TIMESTAMP => TIMESTAMP "2025-01-01 00:00:00 UTC");

Note

The LABELS option in CREATE TABLE CLONE statements are not transformed into TAGs because the TAGs of the source table are copied, they cannot be changed during the copy of the table.

Transformation of other table options are the same as specified for the CREATE TABLE statement.

Last updated