Is ID column required in SQL?

If you really do have some pre-existing column in your data set that already does uniquely identify your row – then no, there’s no need for an extra ID column. The primary key however must be unique (in ALL circumstances) and cannot be empty (must be NOT NULL).

In my 20+ years of experience in database design, however, this is almost never truly the case. Most “natural” ID’s that appear to be unique aren’t – ultimately. US Social Security Numbers aren’t guaranteed to be unique, and most other “natural” keys end up being almost unique – and that’s just not good enough for a database system.

So if you really do have a proper, unique key in your data already – use it! But most of the time, it’s easier and more convenient to have just a single surrogate ID that you can guarantee will be unique over all rows.

Leave a Comment

tech