By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE temp01(
SEQ int,
cat01 numeric(6,0),
cat02 numeric(6,0),
dt_day date,
dt_week date,
dt_month date,
price decimal(10,0)
)
INSERT INTO temp01 VALUES (1, 230, 1, '2019-01-01', '2019-01-05', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (2, 230, 1, '2019-01-02', '2019-01-05', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (3, 230, 1, '2019-01-03', '2019-01-05', '2019-01-31', 13000)
INSERT INTO temp01 VALUES (4, 230, 1, '2019-01-04', '2019-01-05', '2019-01-31', 12000)
INSERT INTO temp01 VALUES (5, 230, 1, '2019-01-05', '2019-01-05', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (6, 230, 1, '2019-01-06', '2019-01-12', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (7, 230, 1, '2019-01-07', '2019-01-12', '2019-01-31', 19000)
INSERT INTO temp01 VALUES (8, 230, 1, '2019-01-08', '2019-01-12', '2019-01-31', 20000)
INSERT INTO temp01 VALUES (9, 230, 1, '2019-01-09', '2019-01-12', '2019-01-31', 21500)
INSERT INTO temp01 VALUES (10, 230, 1, '2019-01-10', '2019-01-12', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (11, 230, 1, '2019-01-11', '2019-01-12', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (12, 230, 1, '2019-01-12', '2019-01-12', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (13, 230, 1, '2019-01-13', '2019-01-19', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (1, 230, 2, '2019-01-01', '2019-01-05', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (2, 230, 2, '2019-01-02', '2019-01-05', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (3, 230, 2, '2019-01-03', '2019-01-12', '2019-01-31', 12000)
INSERT INTO temp01 VALUES (4, 230, 2, '2019-01-04', '2019-01-12', '2019-01-31', 17000)
INSERT INTO temp01 VALUES (5, 230, 2, '2019-01-05', '2019-01-12', '2019-01-31', 22000)
INSERT INTO temp01 VALUES (6, 230, 2,' 2019-01-06', '2019-01-12', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (7, 230, 2,' 2019-01-07', '2019-01-12', '2019-01-31', 23000)
INSERT INTO temp01 VALUES (8, 230, 2, '2019-01-08', '2019-01-12', '2019-01-31', 23200)
INSERT INTO temp01 VALUES (9, 230, 2, '2019-01-09', '2019-01-12', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (10, 230, 2, '2019-01-10', '2019-01-12', '2019-01-31', 24000)
INSERT INTO temp01 VALUES (11, 230, 2, '2019-01-11', '2019-01-12', '2019-01-31', NULL)
INSERT INTO temp01 VALUES (12, 230, 2, '2019-01-12', '2019-01-12', '2019-01-31', NULL)
26 rows affected
SELECT *
FROM temp01
SEQ | cat01 | cat02 | dt_day | dt_week | dt_month | price |
---|---|---|---|---|---|---|
1 | 230 | 1 | 2019-01-01 | 2019-01-05 | 2019-01-31 | null |
2 | 230 | 1 | 2019-01-02 | 2019-01-05 | 2019-01-31 | null |
3 | 230 | 1 | 2019-01-03 | 2019-01-05 | 2019-01-31 | 13000 |
4 | 230 | 1 | 2019-01-04 | 2019-01-05 | 2019-01-31 | 12000 |
5 | 230 | 1 | 2019-01-05 | 2019-01-05 | 2019-01-31 | null |
6 | 230 | 1 | 2019-01-06 | 2019-01-12 | 2019-01-31 | null |
7 | 230 | 1 | 2019-01-07 | 2019-01-12 | 2019-01-31 | 19000 |
8 | 230 | 1 | 2019-01-08 | 2019-01-12 | 2019-01-31 | 20000 |
9 | 230 | 1 | 2019-01-09 | 2019-01-12 | 2019-01-31 | 21500 |
10 | 230 | 1 | 2019-01-10 | 2019-01-12 | 2019-01-31 | null |
11 | 230 | 1 | 2019-01-11 | 2019-01-12 | 2019-01-31 | null |
12 | 230 | 1 | 2019-01-12 | 2019-01-12 | 2019-01-31 | null |
13 | 230 | 1 | 2019-01-13 | 2019-01-19 | 2019-01-31 | null |
1 | 230 | 2 | 2019-01-01 | 2019-01-05 | 2019-01-31 | null |
2 | 230 | 2 | 2019-01-02 | 2019-01-05 | 2019-01-31 | null |
3 | 230 | 2 | 2019-01-03 | 2019-01-12 | 2019-01-31 | 12000 |
4 | 230 | 2 | 2019-01-04 | 2019-01-12 | 2019-01-31 | 17000 |
5 | 230 | 2 | 2019-01-05 | 2019-01-12 | 2019-01-31 | 22000 |
6 | 230 | 2 | 2019-01-06 | 2019-01-12 | 2019-01-31 | null |
7 | 230 | 2 | 2019-01-07 | 2019-01-12 | 2019-01-31 | 23000 |
8 | 230 | 2 | 2019-01-08 | 2019-01-12 | 2019-01-31 | 23200 |
9 | 230 | 2 | 2019-01-09 | 2019-01-12 | 2019-01-31 | null |
10 | 230 | 2 | 2019-01-10 | 2019-01-12 | 2019-01-31 | 24000 |
11 | 230 | 2 | 2019-01-11 | 2019-01-12 | 2019-01-31 | null |
12 | 230 | 2 | 2019-01-12 | 2019-01-12 | 2019-01-31 | null |
13 | 230 | 2 | 2019-01-13 | 2019-01-19 | 2019-01-31 | null |