When to use?
특정 attribute 의 값의 범위를 강제할 때.
ex) birth_date DATE CHECK (birth_date > '1900-01-01')
age INT CHECK (age between 0 and 100)
How to use?
네이밍 컨벤션
<table_name>_<column_name>_check
CREATE TABLE

ALTER TABLE

🔗 Reference
PostgreSQL CHECK Constraint
Summary: in this tutorial, you will learn about the PostgreSQL CHECK constraints and how to use them to constrain values in columns of a table based on a boolean expression. A CHECK constraint is a kind of constraint that allows you to specify if values in
www.postgresqltutorial.com
'DataBase > PostgreSQL' 카테고리의 다른 글
| [PostgreSQL] Delete duplicates in array (0) | 2022.06.22 |
|---|---|
| [PostgreSQL] Use `identity` instead of `serial` (0) | 2022.06.16 |
| [PostgreSQL] Trigger + Transaction (0) | 2022.04.18 |
| [PostgreSQL] Transaction + Pool 사용시 주의 (0) | 2022.04.04 |
| [PostgreSQL] Function (feat. trigger) (0) | 2022.03.29 |