首页  >  文章  >  数据库  >  财政年度表之建表约束

财政年度表之建表约束

大家讲道理
大家讲道理原创
2016-11-12 10:48:051152浏览

Create Table FinancialYear
(fiscal_year INTEGER NOT NULL PRIMARY KEY,
start_date DATE NOT NULL,
CHECK ((EXTRACT(YEAR FROM start_date)=fiscal_year-1)
AND (EXTRACT (MONTH FROM start_date)=10)
AND (EXTRACT(DAY FROM start_date)=1),
end_date DATE NOT NULL,
CONSTRAINT valid_end_date
CHECK ((EXTRACT (YEAR FROM end_date)=fiscal_year)
AND (EXTRACT (MONTH FROM end_date)=9)
AND (EXTRACT (DAY FROM end_date)=30)))

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn