Code:
CREATE TABLE "T1"
(
"ID" NUMBER,
"F_TYPE" CHAR(1 BYTE),
"F_AMT" NUMBER(10, 0),
"DATE_COL" DATE
);
CREATE TABLE "T2"
(
"ID" NUMBER,
"START_DATE" DATE,
"END_DATE" DATE,
"F_ID" NUMBER,
"FLAG" CHAR(1 BYTE)
);
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'F',6,to_date('11-FEB-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'D',2,to_date('11-FEB-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'D',2,to_date('11-FEB-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'F',6,to_date('11-FEB-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'F',2,to_date('12-MAR-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'D',3,to_date('12-MAR-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'F',4,to_date('10-APR-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'F',4,to_date('11-APR-2016','DD-MON-YYYY'));
Insert into T1 (ID,F_TYPE,F_AMT,DATE_COL) values (1,'D',1,to_date('11-APR-2016','DD-MON-YYYY'));
Insert into T2 (ID,START_DATE,END_DATE,F_ID,FLAG) values (1,to_date('11-FEB-2016','DD-MON-YYYY'),to_date('11-MAR-2016','DD-MON-YYYY'),1,'Y');
Insert into T2 (ID,START_DATE,END_DATE,F_ID,FLAG) values (1,to_date('12-MAR-2016','DD-MON-YYYY'),to_date('11-APR-2016','DD-MON-YYYY'),1,'Y');
Insert into T2 (ID,START_DATE,END_DATE,F_ID,FLAG) values (1,to_date('12-MAR-2016','DD-MON-YYYY'),to_date('11-APR-2016','DD-MON-YYYY'),1,'Y');
Insert into T2 (ID,START_DATE,END_DATE,F_ID,FLAG) values (1,to_date('12-APR-2016','DD-MON-YYYY'),to_date('21-APR-2016','DD-MON-YYYY'),2,'Y');
Insert into T2 (ID,START_DATE,END_DATE,F_ID,FLAG) values (1,to_date('22-APR-2016','DD-MON-YYYY'),to_date('02-MAY-2016','DD-MON-YYYY'),3,'N');