Skip to content

Instantly share code, notes, and snippets.

@vvgsrk
Last active April 27, 2022 02:45
Show Gist options
  • Save vvgsrk/564bdc15d804a58a819aa21bedfdbd33 to your computer and use it in GitHub Desktop.
Save vvgsrk/564bdc15d804a58a819aa21bedfdbd33 to your computer and use it in GitHub Desktop.
Product History DDL and DML
CREATE TABLE product_history (
product_id NUMBER,
product_name VARCHAR,
price_per_unit VARCHAR,
basic_unit VARCHAR,
is_stock_limited VARCHAR,
is_active_for_sale VARCHAR,
__event_ts TIMESTAMP_NTZ(9),
__load_ts TIMESTAMP_NTZ(9)
);
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1001, 'Nairobi Coffee', '5 EUR', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1001, 'Nairobi Coffee', '5.5 EUR', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1002, 'Singapore Coffee', '3 SGD', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1002, 'Singapore Coffee', '4 SGD', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1003, 'Barcelona Coffee', '6 EUR', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1003, 'Barcelona Coffee', '4 EUR', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1004, 'Helsinki Coffee', '5 EUR', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1004, 'Helsinki Coffee', '5 EUR', 'piece', 'Yes', 'No', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1005, 'Talinn Coffee', '3 EUR', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1005, 'Talinn Coffee', '13 EUR', 'pack of 4', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1006, 'Prague Coffee', '4 EUR', 'piece', 'Yes', 'No', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1006, 'Prague Coffee', '20 EUR', 'pack of 3', 'Yes', 'No', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1006, 'Prague Coffee', '20 EUR', 'pack of 4', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1007, 'Dubai Coffee', '20 AED', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1007, 'Dubai Coffee', '20 AED', 'piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
INSERT INTO product_history (product_id, product_name, price_per_unit, basic_unit, is_stock_limited, is_active_for_sale, __event_ts, __load_ts)
VALUES(1008, 'Bangkok Coffee', '100 THB', '2 piece', 'No', 'Yes', DATEADD(hour, -1, DATEADD(Day ,-1, CURRENT_TIMESTAMP())), CURRENT_TIMESTAMP());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment