An update statement is used to edit a row in an existing tuple of a table. A CHECK constraint is used to make sure that new values are checked: some will fail and the tuple will not be allowed to be updated.
An update statement is written like follows:
UPDATE users SET password = $2, first_name = $3, last_name = $4, gender = $5, birthdate = $6, born_city = $7, born_country = $8, lives_city = $9, lives_country = $10 WHERE username = $1
The CHECK constraint was implemented upon the creation of the table:
CREATE TABLE users ( username VARCHAR(20) NOT NULL, -- decided to do this to get a URL ... birthdate DATE CHECK (birthdate <= now()::date), ... );
A CHECK constraint can be added when a table is altered using the following command:
ALTER TABLE users ADD CONSTRAINT birthdate_past CHECK (birthdate <= now()::date);
node()::date gets the current date