MySQL Forums
Forum List  »  Partitioning

Partitioning by year/quarter
Posted by: Ravi Malghan
Date: September 24, 2012 10:32AM

Hi: I have a datetime column in my table and I want to partition by quarter of every year for the next 5 years. The table and partitions seems to have created fine. Not sure if this will work since quarter function returns an integer without the year. Can someone comment?


CREATE TABLE STATUS (
id NUMERIC(16) NOT NULL,
FIRSTOCCURRENCE DATETIME NOT NULL,
PRIMARY KEY ( ID,FIRSTOCCURRENCE )
)

PARTITION BY RANGE (QUARTER(FIRSTOCCURRENCE))
(
        PARTITION p2012_3 values less than (20123),
        PARTITION p2012_4 values less than (20124),
        PARTITION p2013_1 values less than (20131),
        PARTITION p2013_2 values less than (20132),
        PARTITION p2013_3 values less than (20133),
        PARTITION p2013_4 values less than (20134),
        PARTITION p2014_1 values less than (20141),
        PARTITION p2014_2 values less than (20142),
        PARTITION p2014_3 values less than (20143),
        PARTITION p2014_4 values less than (20144),
        PARTITION p2015_1 values less than (20151),
        PARTITION p2015_2 values less than (20152),
        PARTITION p2015_3 values less than (20153),
        PARTITION p2015_4 values less than (20154),
        PARTITION p2016_1 values less than (20161),
        PARTITION p2016_2 values less than (20162),
        PARTITION p2016_3 values less than (20163),
        PARTITION p2016_4 values less than (20164),
        PARTITION p2017_1 values less than (20171),
        PARTITION p2017_2 values less than (20172),
        PARTITION p2017_3 values less than (20173),
        PARTITION p2017_4 values less than (20174),
        PARTITION p2018_1 values less than (MAXVALUE)
);

Options: ReplyQuote


Subject
Views
Written By
Posted
Partitioning by year/quarter
7593
September 24, 2012 10:32AM
3318
September 27, 2012 01:31PM
2292
October 02, 2012 09:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.