MySQL - Are “NOT NULL” constraints needed for primary keys?

前端 未结 4 580
轮回少年
轮回少年 2021-01-04 04:15

is it necessary to declare \"NOT NULL\" constraints for primary keys in the MySQL database? A primary key cannot have NULL values because it auto_increments anyway and auto

4条回答
  •  执笔经年
    2021-01-04 04:43

    Yes and no You can remove "Not null", that won't remove the constraint though. Personally I'd leave them in, you gain nothing worthwhile from taking them out.

提交回复
热议问题