Why use an auto-incrementing primary key when other unique fields exist?

前端 未结 12 2202
悲&欢浪女
悲&欢浪女 2021-01-30 10:36

I\'m taking a course called \"database systems\" and for our class project I have to design a website.

Here\'s an example of a table I created:

CREATE TA         


        
12条回答
  •  死守一世寂寞
    2021-01-30 11:15

    Your professor is doing the right thing by pointing out that you should have made username unique and not nullable if it was a requirement that user names should be unique. The uid could be a key as well but unless you are actually using it somewhere then it isn't needed. The more important aspect of the design ought to be to implement the natural key. So I agree with your professor's comment.

提交回复
热议问题