primary key 기본키
- table당 한 개만 존재한다.
- unique + not null
설정
alter table table명 add constraint primary key(column명);
alter table table명 modify column명 자료형 primary key;
제거
alter table table명 drop primary key;
alter table table명 drop constraint column명;
- (not null은 제거 안 됨)
⇒alter table table명 modify column명 자료형 null;
→ 만약 auto_increment가 걸려있다면 먼저 제거를 하고 그 다음 진행해야 한다.
alter table table명 modify column명 자료형 not null;
alter table table명 drop primary key;
'DB > MariaDB' 카테고리의 다른 글
[MariaDB] MariaDB ERROR 2002 (HY000): Can't connect to local server through socket '/tmp/mysql.sock' (2) (0) | 2022.12.20 |
---|---|
[MariaDB] 15. foreign key (0) | 2022.12.20 |
[MariaDB] 13.auto_increment (0) | 2022.12.20 |
[MariaDB] 12.union (0) | 2022.12.20 |
[MariaDB] 11. join (0) | 2022.12.20 |
댓글