Skip to content

Commit

Permalink
πŸ“ [Docs] Integrity Constraints (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
luke0408 committed Oct 17, 2023
1 parent 3bb9a6e commit e1f0635
Showing 1 changed file with 44 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Example 1
# Integrity Constraints

> μž‘μ„±μž: 루카(μ΅œμ„ κ·œ)
> μž‘μ„±μž: μ΅œμ„ κ·œ
## λͺ©μ°¨
## Not Null

`NOT NULL` μ œμ•½ 쑰건은 νŠΉμ • μ»¬λŸΌμ— `NULL` 값을 ν—ˆμš©ν•˜μ§€ μ•ŠλŠ”λ‹€λŠ” 것을 μ˜λ―Έν•œλ‹€.

ex)

```sql
CREATE TABLE table_name (
column_name1 datatype NOT NULL,
column_name2 datatype,
...
);
```

## Unique

'UNIQUE' μ œμ•½ 쑰건은 νŠΉμ • μ»¬λŸΌμ— μ€‘λ³΅λœ 값을 ν—ˆμš©ν•˜μ§€ μ•ŠλŠ”λ‹€λŠ” 것을 μ˜λ―Έν•œλ‹€.

ex)

```sql
CREATE TABLE table_name (
column_name1 datatype UNIQUE,
column_name2 datatype,
...
);
```

## Check clause

`CHECK` μ œμ•½ 쑰건은 νŠΉμ • μ»¬λŸΌμ— νŠΉμ • 쑰건을 λ§Œμ‘±ν•˜λŠ” κ°’λ§Œ ν—ˆμš©ν•œλ‹€λŠ” 것을 μ˜λ―Έν•œλ‹€.

ex)

```sql
CREATE TABLE table_name (
column_name1 datatype,
column_name2 datatype,
...
CHECK (column_name1 > 0)
);
```

0 comments on commit e1f0635

Please sign in to comment.