Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6339375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:38:15+00:00 2026-05-24T19:38:15+00:00

I am new to postgres and DW, and I have to design a DATE

  • 0

I am new to postgres and DW, and I have to design a DATE Dimension as given in book. I saw many places on the web and I did not succeed so far, can some explain how to populate fields like 'Fiscal Week', 'Fiscal Month', 'Fiscal Half year'

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:38:16+00:00Added an answer on May 24, 2026 at 7:38 pm

    I guess that you want 10 years Date Dimension table with all columns presented in Figure 2.4 (based on Google Books). Check in documentation:

    • Formatting function to_char with Table 9-21 for template patterns
    • Extracting function date_part
    • Generating row series with generate_series(start, stop, step interval)

    To get all days within 10 years you could write:

    SELECT generate_series('2001-01-01'::date, '2010-12-31'::date, '1 day') AS day;
    
    SELECT count(*) FROM generate_series('2001-01-01'::date, '2010-12-31'::date, '1 day');
     count 
    -------
      3652
    (1 row)
    

    According to Figure 2.5 create table as e.g.:

    DROP TABLE IF EXISTS "Date Dimension";
    CREATE TABLE "Date Dimension"
    (
        "Date Key" serial,
        "Date" date,
        "Full Day Description" text,
        "Day Of Week" text,
        "Calendar Month" text,
        "Calendar Year" integer,
        "Fiscal Year Month" text,
        "Holiday Indicator" text,
        "Weekday Indicator" text 
    );
    

    Insert command:

    INSERT INTO "Date Dimension"
        ("Date", "Full Day Description", "Day Of Week", "Calendar Month",
        "Calendar Year", "Fiscal Year Month", "Holiday Indicator",
        "Weekday Indicator")
    SELECT
        day,
        rtrim(to_char(day, 'Month')) || to_char(day, ' DD, YYYY'),
        to_char(day, 'Day'),
        rtrim(to_char(day, 'Month')),
        date_part('year', day),
        'F' || to_char(day, 'YYYY-MM'),
        '', --omitting (trivial 'Holiday'/'Non-Holiday, but how to get this ??),
        CASE
            WHEN date_part('isodow', day) IN (6, 7) THEN 'Weekend'
            ELSE 'Weekday'
        END
    FROM
        generate_series('2001-01-01'::date, '2010-12-31'::date, '1 day') day;
    

    I hope this gives you some framework and starting point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a migration that runs an SQL script to create a new Postgres
I have a php script to insert new parts into a postgres database. I
I have an issue, I'm trying to insert a new row into a postgres
I'm starting a new project and I have maybe three resources defined. Not a
I'm new to conditional statements within postgres. I have the following statement SELECT IF
I am very new to Postgres and the main problem I have now is
I have a peculiar problem with Postgres and PHP . I just set-up new
I have a Spring-MVC, Hibernate, (Postgres 9 db) Web app. An admin user can
I have the following table in postgres: CREATE TABLE test ( id serial NOT
I'm new to the Oracle Platform (having primarily used MySQL, with a little Postgres

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.