I am trying to add values to a newly created column from another column in SNOWFLAKE database, could someone please help. I want values of OrderID column to be inserted in CompanyID
The table has to be updated:
UPDATE tab
SET CompanyID = OrderID
-- WHERE CompanyID IS NULL;
If the table is createad first time column CompanyID could be added inside CTAS:
CREATE TABLE tab
AS
SELECT OrderID AS CompanyID, OrderID, CustomerName
FROM db_soure_name.schema_name_table_name;