追溯到關系數據庫理論的創始人E
假設一個表包含SubTotal 和TaxRate 兩個列
該原則的一個替代方案叫做計算列(computed column)
假設一個數據庫包含有房子粉刷估計
如果不使用計算列
可以使用下面這樣的語句來創建表
CREATE TABLE [TestComputedColumns] (
[PK] [int] IDENTITY (
[Length] [int] NOT NULL
[Width] [int] NOT NULL
[Height] [int] NOT NULL
[Coats] [int] NOT NULL CONSTRAINT [DF_TestComputedColumns_Coats] DEFAULT
(
[IncludeCeiling] [bit] NOT NULL CONSTRAINT
[DF_TestComputedColumns_IncludeCeiling] DEFAULT (
[Area] AS ((
[Width] * [IncludeCeiling]) * [Coats])
CONSTRAINT [PK_TestComputedColumns] PRIMARY KEY CLUSTERED
(
[PK]
) ON [PRIMARY]
) ON [PRIMARY]
GO
你不妨使用自己的前台程序
From:http://tw.wingwit.com/Article/os/youhua/201311/10780.html