Check Constraint

The CHECK constraint is a type of constraint that makes sure the values in a column meet a certain requirement. If the values qualify the CHECK constraint, PostgreSQL adds or updates these values to the column. Otherwise, PostgreSQL will reject the changes and throw a constraint violation error.

CREATE TABLE isciler (id SERIAL PRIMARY KEY, ad VARCHAR (50),
soyad VARCHAR (50), dogum_tarihi DATE CHECK (dogum_tarihi >
‘1960-01-01’), baslama_tarihi DATE CHECK (baslama_tarihi >
dogum_tarihi), maas INT CHECK (maas > 500))

INSERT INTO isciler(ad, soyad, dogum_tarihi, baslama_tarihi,
maas) VALUES (‘Ayse’, ‘Çiçek’, ‘1972-01-01’, ‘2015-07-01’,
250);

The last query returns an error because it does not meet the maas > 500 condition.