Announcing our $3.4M seed round 🚀 Read more →

How to Update Data in Snowflake in Snowflake

Usually you only want to update rows that match a certain condition. You do this by specifying a WHERE clause:

--this will update only one row that matches id = 1
update sessions
set start_date = '2020-04-20 10:12:15.653',
    end_date = '2020-04-22 15:40:30.123'
where id = 1;

--this will update multiple rows that match category = 1
update sessions
set end_date = null
where category = 1;

To update all rows in a Snowflake table, just use the UPDATE statement without a WHERE clause:

update sessions
set end_date = '2020-04-04 16:57:53.653';

You can also update multiple columns at a time:

update sessions
set start_date = '2020-04-02 14:05:15.400',
    end_date = '2020-04-04 16:57:53.653';

Ready for a modern SQL editor?