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

前端 未结 12 2298
悲&欢浪女
悲&欢浪女 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条回答
  •  Happy的楠姐
    2021-01-30 11:00

    For instance, integer search (?id=5) is much way faster and has higher cardinality than string search (?username=bob). Another example, uid is auto_increment, so you don't have to insert it explicitly but it will auto increment in each insert query.

    PS: Your prof is soooo wrong about it :D

提交回复
热议问题