Home  >  Article  >  Database  >  Financial year table construction constraints

Financial year table construction constraints

大家讲道理
大家讲道理Original
2016-11-12 10:48:051118browse

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)))

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn