On Snowflake is there a way to create table with subset of columns populated from Select statement from other tables ?
From the examples I see on documentation, we can either populate all the columns through Select from other tables or populate none of the columns.
One way would be to select NULL cast to the desired data type, with an alias as part of the SELECT statement.
CREATE TABLE t1 AS
SELECT
    col1,
    col2,
    NULL::timestamp_ntz AS col3,
    NULL::number AS col4
FROM t2;
This example would create a table t1 with four columns, two of which come from t2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With