0

I need an sql query to alter a table to add in a date column, which is the part I know how to do. What I don't know how to do is specify that the dates in the column need to be after a certain date.

My latest attempt:

ALTER TABLE <table name>
ADD constraint <constraint name>
CHECK (<column name>(date, 'YYYY-MM-DD') >= '2000-01-01');

I'm using pgadmin4.

Help pls
  • 15
  • 1
  • 7

1 Answers1

0

How about this?

ALTER TABLE t ADD constraint chk_t_col CHECK (col >= '2000-01-01');
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786