Skip to content

Instantly share code, notes, and snippets.

@dsmdavid
Last active April 5, 2023 08:29
Show Gist options
  • Save dsmdavid/f9d0de9cee2231fc5825b84d8d299ed3 to your computer and use it in GitHub Desktop.
Save dsmdavid/f9d0de9cee2231fc5825b84d8d299ed3 to your computer and use it in GitHub Desktop.
-- preparation:
-- create three identical tables derived from Snowflake's sample data TPCH_SF100
-- introduce some small variations in one of them
set var_db = 'test_db';
set var_schema = 'david_test';
use database identifier($var_db);
use schema identifier($var_schema);
create or replace table "LINEITEM_ORIGINAL" as
select * from "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF100"."LINEITEM";
create or replace table "LINEITEM_EXACT_COPY" clone "LINEITEM_ORIGINAL";
create or replace table "LINEITEM_FEW_CHANGES" clone "LINEITEM_ORIGINAL";
-- introduce some errors
update "LINEITEM_FEW_CHANGES"
set L_QUANTITY = '22'
where L_QUANTITY = '20'
and L_SHIPDATE >= '1998-08-16' and L_SHIPDATE < '1998-08-20';
-- returns 17487 rows updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment