如何在日期维度中推导出季节 [英] how to derive season in a date dimension

查看:82
本文介绍了如何在日期维度中推导出季节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施DataWarehouse日期维度。根据我的情况,我必须将Octomber-January之间的日期标记为Season_A,将4月至8月之间的日期标记为Season_B。我创建了'dimDate'表,如下所示。

I'm implementing a DataWarehouse date dimension. According to my scenario I have to mark days between Octomber-January as 'Season_A' and days between April-August as 'Season_B'. I have created the 'dimDate' table as below.

CREATE TABLE dbo.dimDate 
( 
DateKey INT NOT NULL, 
FullDate DATE NOT NULL, 
MonthNumberName NVARCHAR(15) NULL, 
CalendarQuarter TINYINT NULL, 
CalendarYear SMALLINT NULL, 
Season NVARCHAR(10) 
CONSTRAINT PK_Dates PRIMARY KEY (DateKey)
 );
 GO

推荐答案

阅读以下内容:

http://en.wikipedia.org/wiki/Season [ ^ ]

http://www.w3schools.com/sql/func_datepart.asp [ ^ ]

简单使用SQL CASE表达式 [ ^ ]
Read the following :
http://en.wikipedia.org/wiki/Season[^]
http://www.w3schools.com/sql/func_datepart.asp[^]
A Simple Use of SQL CASE Expression[^]


这篇关于如何在日期维度中推导出季节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆