> [!tldr]
> A **constraint** can be applied when creating a table.
#### Constraint for primary key
```
CONSTRAINT constraint_name
PRIMARY KEY (primary_key_column_name)
```
Example:
```
CONSTRAINT pk_people PRIMARY KEY (person_id)
```
#### Constraint for foreign key
```
CONSTRAINT constraint_name
FOREIGN KEY (foreign_key_column_name)
REFERENCES another_table (some_key_column)
```
Example:
```
CONSTRAINT fk_office_person_id FOREIGN KEY (person_id) REFERENCES office (office_id)
```