DB2 Create partitioned table

Source: Internet
Author: User
Tags db2

On the z and open platform on the creation method is not quite the same, two sets of horses developed by the cow!

The egg hurts ...

Paste a few examples of different types to feel the Asc,desc on Z is missing:

CREATE TABLE INT )     by-(1)     ending at (+) every ()) 
CREATE TABLELineItem (L_orderkeyDECIMAL(Ten,0) not NULL, L_quantityDECIMAL( A,2), L_shipdate DATE, L_year_monthINTGENERATED always as( Year(l_shipdate)* - + MONTH(l_shipdate))) PARTITION byRANGE (L_shipdate) (Starting ('1/1/1992') Ending ('12/31/1992') every1 MONTH);
CREATE TABLE INT INT )     by-(1)  EXCLUSIVE ending at (+) every (  ))
CREATE TABLElineitem2 (L_orderkeyDECIMAL(Ten,0) not NULL, L_quantityDECIMAL( A,2), L_shipdateTIMESTAMP, L_year_monthINTGENERATED always as( Year(l_shipdate)* - + MONTH(l_shipdate))) PARTITION byRANGE (L_shipdate) (Starting ('1992-01-01-00.00.00.000000') Ending ('1992-12-31-23.59.59.999999') every1 MONTH)
CREATE TABLElineitem3 (L_orderkeyDECIMAL(Ten,0) not NULL, L_quantityDECIMAL( A,2), L_shipdateTIMESTAMP, L_year_monthINTGENERATED always as( Year(l_shipdate)* - + MONTH(l_shipdate))) PARTITION byRANGE (L_shipdate) (Starting ('1/1/1992') Ending ('12/31/1992') every1 MONTH)
CREATE TABLESales (invoice_date date, Inv_monthint  not NULLGENERATED always as(Month(invoice_date)), Inv_yearINT  not NULLGENERATED always as( Year(Invoice_date)), item_idint  not NULL, cust_idint  not NULL) PARTITION byRANGE (Inv_year, Inv_month) (part q1_02 starting (2002,1) Ending (2002,3) Inclusive,part q2_02 ending (2002,6) Inclusive,part q3_02 ending (2002,9) Inclusive,part q4_02 ending (2002, A) Inclusive,part CurrentEnding (MAXVALUE, MAXVALUE));
CREATE TABLE INT )    by  RANGE (a)    from (1) ending at (+ ),      from (201) ending at (+))

DB2 Create partitioned table

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.