concept: table column - davidkhala/database GitHub Wiki
null 值处理
处理NULL值的方法有很多,但任何一种方式都不是很好。大致而言,必须根据对数据的认知对症下药
Surrogate key
A surrogate key is a unique identifier derived from the data itself.
- It often takes the form of a hashed value of multiple columns that will create a uniqueness constraint for each row.
- You will need to define a surrogate key for every table that doesn't have a natural primary key.
-
It's often an integer value that is automatically generated by the DBMS when a new row is inserted into the table.
-
- It's common for a dimension table to include
alternate key
aka. business key, natural key
- identifies a specific instance of an entity in the transactional source system
- It works similarly but is not primary key
- It has business meaning
- e.g. product code, customer ID or employee number