| 历史视图 | 含 is_deleted=1 行 |
|---|---|
| 当前视图 | is_deleted=0 且 is_current=1 |
| 对外 | 只暴露声明口径的视图 |
双视图
双视图
CREATE VIEW v_dim_customer_hist AS SELECT * FROM dim_customer;
CREATE VIEW v_dim_customer_cur AS SELECT * FROM dim_customer
WHERE is_current = 1 AND (is_deleted = 0 OR is_deleted IS NULL);报表引用当前视图时,历史期间的失效成员不出现,这是预期行为而非数据缺失。