Oracle SQL Query for Full Load and Incremental Load

preview_player
Показать описание
#antosh #dyade #sql
Incremental loading is the activity of loading only new or updated records from a source into Treasure Data. Incremental loads are useful because they run efficiently when compared to full loads, particularly for large data sets.
Рекомендации по теме
Комментарии
Автор

--SQL Query for Incremental Load

--Source Table
CREATE TABLE S1(sd1 number, sd2 varchar2(10), sdate date);


--Target Table
CREATE TABLE T1(td1 number, td2 varchar2(10), tdate date);


INSERT INTO S1 VALUES(1, 'antosh1', '18-07-22');
INSERT INTO S1 VALUES(2, 'antosh2', '18-07-22');
INSERT INTO S1 VALUES(3, 'antosh3', '19-07-22');
INSERT INTO S1 VALUES(4, 'antosh4', '19-07-22');
INSERT INTO S1 VALUES(5, 'antosh5', '19-07-22');

COMMIT;

SELECT * FROM S1;

SELECT * FROM T1;


--Full Load
INSERT INTO T1(td1, td2, tdate) SELECT sd1, sd2, sdate FROM S1;

COMMIT;

SELECT * FROM T1;


--INCREMENTAL LOAD

INSERT INTO S1 VALUES(1, 'antosh6', '20-07-22');
INSERT INTO S1 VALUES(2, 'antosh7', '20-07-22');
INSERT INTO S1 VALUES(3, 'antosh8', '20-07-22');
INSERT INTO S1 VALUES(4, 'antosh9', '20-07-22');
INSERT INTO S1 VALUES(5, 'antosh10', '20-07-22');

SELECT * FROM S1;


SELECT * FROM T1;

--Incremental Load
INSERT INTO T1(td1, td2, tdate) SELECT sd1, sd2, sdate FROM S1
WHERE sdate>(SELECT max(tdate) from T1);

COMMIT;

SELECT * FROM T1;

etlguru
Автор

Thanks for the Video / Good Job Keep it up

anandd
Автор

Do u have datastage videos? Pls upload.

karthikg