zoukankan      html  css  js  c++  java
  • ORACLE添加分区表

    -- Create table
    create table T_REPORT_DAILYSALES
    (
      ORDERDATE  DATE not null,
      BRANCHFLAG CHAR(3) not null,
      PRODID     CHAR(11) not null,
      QUANTITY   NUMBER(15,2),
      AMOUNT     NUMBER(15,2)
    )
    partition by range (ORDERDATE)
    (
       partition Daysales2009_01 values less than (TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_02 values less than (TO_DATE(' 2009-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_03 values less than (TO_DATE(' 2009-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_04 values less than (TO_DATE(' 2009-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_05 values less than (TO_DATE(' 2009-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_06 values less than (TO_DATE(' 2009-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_07 values less than (TO_DATE(' 2009-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_08 values less than (TO_DATE(' 2009-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_09 values less than (TO_DATE(' 2009-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_10 values less than (TO_DATE(' 2009-10-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_11 values less than (TO_DATE(' 2009-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        ),
      partition Daysales2009_12 values less than (TO_DATE(' 2009-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        tablespace RPTFACT2009
        pctfree 10
        initrans 1
        maxtrans 255
        storage
        (
          initial 10M
          minextents 1
          maxextents unlimited
        )
    )
    ;

    comment on table T_REPORT_DAILYSALES
      is '商品日均销量(31天)';
    -- Add comments to the columns
    comment on column T_REPORT_DAILYSALES.ORDERDATE
      is '日期';
    comment on column T_REPORT_DAILYSALES.BRANCHFLAG
      is '分公司标识';
    comment on column T_REPORT_DAILYSALES.PRODID
      is '商品内码';
    comment on column T_REPORT_DAILYSALES.QUANTITY
      is '数量';
    comment on column T_REPORT_DAILYSALES.AMOUNT
      is '金额';

    -- Create/Recreate indexes
    alter table T_REPORT_DAILYSALES
      add primary key (ORDERDATE, BRANCHFLAG, PRODID)
      using index
      tablespace RPTINDEX
      pctfree 10
      initrans 2
      maxtrans 255
      storage
      (
        initial 5M
        minextents 1
        maxextents unlimited
      );

  • 相关阅读:
    一些比较水的题目
    oracle not in,not exists,minus 数据量大的时候的性能问题
    简单的oracle分页语句
    oracle 查询结果集运算
    Spring注解详解
    HTTP报头Accept 和 Content-Type的区别
    vue 实现分转元的 过滤器
    oracle or语句的坑
    CSS样式 让你的输入的小写自动变成大写。
    js 十分精确身份证验证
  • 原文地址:https://www.cnblogs.com/pan11jing/p/1538257.html
Copyright © 2011-2022 走看看