-- table operation tests DROP TABLE IF EXISTS bs_date_table; NOTICE: table "bs_date_table" does not exist, skipping CREATE TABLE bs_date_table( id SERIAL PRIMARY KEY, ad date, bs bs_date ); INSERT INTO bs_date_table (ad, bs) VALUES ('2001/02/01', '2056/10/19'), ('2002/02/01', '2057/10/19'), ('1972-02-17', '2028-11-05'), ('1968-10-07', '2025-06-22'); INSERT INTO bs_date_table (ad, bs) VALUES ('2001-02-01', ad_to_bs('2001/02/01')); SELECT * FROM bs_date_table; id | ad | bs ----+------------+------------ 1 | 02-01-2001 | 2056-10-19 2 | 02-01-2002 | 2057-10-19 3 | 02-17-1972 | 2028-11-05 4 | 10-07-1968 | 2025-06-22 5 | 02-01-2001 | 2057-10-19 (5 rows) SELECT * FROM bs_date_table ORDER BY bs; id | ad | bs ----+------------+------------ 4 | 10-07-1968 | 2025-06-22 3 | 02-17-1972 | 2028-11-05 1 | 02-01-2001 | 2056-10-19 2 | 02-01-2002 | 2057-10-19 5 | 02-01-2001 | 2057-10-19 (5 rows) SELECT * FROM bs_date_table ORDER BY bs DESC; id | ad | bs ----+------------+------------ 2 | 02-01-2002 | 2057-10-19 5 | 02-01-2001 | 2057-10-19 1 | 02-01-2001 | 2056-10-19 3 | 02-17-1972 | 2028-11-05 4 | 10-07-1968 | 2025-06-22 (5 rows) SELECT * FROM bs_date_table WHERE bs < '2056/10/19'; id | ad | bs ----+------------+------------ 3 | 02-17-1972 | 2028-11-05 4 | 10-07-1968 | 2025-06-22 (2 rows) SELECT * FROM bs_date_table WHERE bs <= '2056/10/19'; id | ad | bs ----+------------+------------ 1 | 02-01-2001 | 2056-10-19 3 | 02-17-1972 | 2028-11-05 4 | 10-07-1968 | 2025-06-22 (3 rows) SELECT * FROM bs_date_table WHERE bs > '2056/10/19'; id | ad | bs ----+------------+------------ 2 | 02-01-2002 | 2057-10-19 5 | 02-01-2001 | 2057-10-19 (2 rows) SELECT * FROM bs_date_table WHERE bs >= '2056/10/19'; id | ad | bs ----+------------+------------ 1 | 02-01-2001 | 2056-10-19 2 | 02-01-2002 | 2057-10-19 5 | 02-01-2001 | 2057-10-19 (3 rows) SELECT * FROM bs_date_table WHERE bs = '2056/10/19'; id | ad | bs ----+------------+------------ 1 | 02-01-2001 | 2056-10-19 (1 row) SELECT * FROM bs_date_table WHERE bs != '2056/10/19'; id | ad | bs ----+------------+------------ 2 | 02-01-2002 | 2057-10-19 3 | 02-17-1972 | 2028-11-05 4 | 10-07-1968 | 2025-06-22 5 | 02-01-2001 | 2057-10-19 (4 rows) SELECT * FROM bs_date_table WHERE bs <> '2056/10/19'; id | ad | bs ----+------------+------------ 2 | 02-01-2002 | 2057-10-19 3 | 02-17-1972 | 2028-11-05 4 | 10-07-1968 | 2025-06-22 5 | 02-01-2001 | 2057-10-19 (4 rows)