DB: To use identity column or not?

前端 未结 4 756
遥遥无期
遥遥无期 2021-02-06 08:33

While designing a table my colleague here says that I should avoid identity column as it is specific to SQL Server and MS Access, But I differ with his views as it makes my codi

4条回答
  •  迷失自我
    2021-02-06 08:59

    As far as i am aware, every slightly serious RDBMS has some sort of unique numbering scheme per table.

    1. Access and SQL Server have identity columns
    2. MySQL has auto increment columns
    3. PostgreSQL has sequences
    4. sqlite has an implicit ROWID column
    5. Oracle has some sort of sequence though I'm not at all familiar with it

    I mostly use it, theoretically it's not always a requirement but if you want to maintain referential integrity an int is less to store and easier to compare than a varchar, especially if your foreign keys would be more complex than a single column.

提交回复
热议问题