clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2805438 fiddles created (40841 in the last week).

select version();
version
PostgreSQL 12.8 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1), 64-bit
 hidden batch(es)


CREATE TABLE assign_dates ( p_date DATE );
 hidden batch(es)


INSERT INTO assign_dates (p_date) values('29-08-2021'::DATE),('29-09-2021'::DATE);
2 rows affected
 hidden batch(es)


SELECT * FROM GENERATE_SERIES ( (SELECT MIN(p_date) FROM assign_dates), (SELECT MAX(p_date) FROM assign_dates), '1 DAY' ) AS tab (the_date);
the_date
2021-08-29 00:00:00+01
2021-08-30 00:00:00+01
2021-08-31 00:00:00+01
2021-09-01 00:00:00+01
2021-09-02 00:00:00+01
2021-09-03 00:00:00+01
2021-09-04 00:00:00+01
2021-09-05 00:00:00+01
2021-09-06 00:00:00+01
2021-09-07 00:00:00+01
2021-09-08 00:00:00+01
2021-09-09 00:00:00+01
2021-09-10 00:00:00+01
2021-09-11 00:00:00+01
2021-09-12 00:00:00+01
2021-09-13 00:00:00+01
2021-09-14 00:00:00+01
2021-09-15 00:00:00+01
2021-09-16 00:00:00+01
2021-09-17 00:00:00+01
2021-09-18 00:00:00+01
2021-09-19 00:00:00+01
2021-09-20 00:00:00+01
2021-09-21 00:00:00+01
2021-09-22 00:00:00+01
2021-09-23 00:00:00+01
2021-09-24 00:00:00+01
2021-09-25 00:00:00+01
2021-09-26 00:00:00+01
2021-09-27 00:00:00+01
2021-09-28 00:00:00+01
2021-09-29 00:00:00+01
 hidden batch(es)


SELECT the_date, EXTRACT(ISODOW FROM the_date), TO_CHAR(the_date, 'Day') FROM ( SELECT * FROM GENERATE_SERIES ( (SELECT MIN(p_date) FROM assign_dates), (SELECT MAX(p_date) FROM assign_dates), '1 DAY' ) AS tab01 (the_date) ) AS tab02 WHERE EXTRACT(ISODOW FROM the_date) BETWEEN 1 AND 5;
the_date date_part to_char
2021-08-30 00:00:00+01 1 Monday
2021-08-31 00:00:00+01 2 Tuesday
2021-09-01 00:00:00+01 3 Wednesday
2021-09-02 00:00:00+01 4 Thursday
2021-09-03 00:00:00+01 5 Friday
2021-09-06 00:00:00+01 1 Monday
2021-09-07 00:00:00+01 2 Tuesday
2021-09-08 00:00:00+01 3 Wednesday
2021-09-09 00:00:00+01 4 Thursday
2021-09-10 00:00:00+01 5 Friday
2021-09-13 00:00:00+01 1 Monday
2021-09-14 00:00:00+01 2 Tuesday
2021-09-15 00:00:00+01 3 Wednesday
2021-09-16 00:00:00+01 4 Thursday
2021-09-17 00:00:00+01 5 Friday
2021-09-20 00:00:00+01 1 Monday
2021-09-21 00:00:00+01 2 Tuesday
2021-09-22 00:00:00+01 3 Wednesday
2021-09-23 00:00:00+01 4 Thursday
2021-09-24 00:00:00+01 5 Friday
2021-09-27 00:00:00+01 1 Monday
2021-09-28 00:00:00+01 2 Tuesday
2021-09-29 00:00:00+01 3 Wednesday
 hidden batch(es)