generated from Poin-Book/study_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π [Docs] Integrity Constraints (#4)
- Loading branch information
Showing
1 changed file
with
44 additions
and
3 deletions.
There are no files selected for viewing
47 changes: 44 additions & 3 deletions
47
Chapter 04 - Intermediate SQL/Item 04 - Integrity Constraints/Note.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
); | ||
``` |