Create a date master table in the Oracle database

Source: Internet
Author: User
The date functions provided by Oracle can meet all the daily operations on the date. Generally, when designing the table structure, we often encounter date fields.

The date functions provided by Oracle can meet all the daily operations on the date. Generally, when designing the table structure, we often encounter date fields.

The date functions provided by Oracle can meet all the daily operations on the date. Generally, we often encounter date fields when designing table structures. If the business needs to summarize the data of the week where the given date is located, and summarize the data of each week in the month where the given date is located, it will be complicated to write SQL statements directly.

Therefore, I directly create a date master table in the data, and calculate the statistical fields that may be used first, you only need to connect to the table to obtain the desired result.

The following describes how to create a table and how to generate data. You can add new fields to meet different requirements. You can create related indexes as needed!

We also welcome you to discuss better methods! Do not hesitate to advise!

1. Create a date primary table

2. Insert Date data

3. Set the values of related fields

4. Set the monthly week

5. Set the first and last days of the week.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.