Is ID column required in SQL?

前端 未结 8 1588
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 23:50

Traditionally I have always used an ID column in SQL (mostly mysql and postgresql).

However I am wondering if it is really necessary if the rest of the columns in ea

8条回答
  •  清歌不尽
    2020-12-30 00:02

    If you are sure that any other column is going to have unique data for every row and isn't going to have NULL at any time then there is no need of separate ID column to distinguish each row from others, you can make that existing column primary key for your table.

提交回复
热议问题