zoukankan      html  css  js  c++  java
  • postgresql自增id

    drop index Ix_product_define_id;
    
    drop index Ix_user_umid;
    
    drop table invims_product_attention;
    
    /*==============================================================*/
    /* Table: invims_product_attention */
    /*==============================================================*/
    create false table invims_product_attention (
    product_attention_id SERIAL not null,
    user_umid VARCHAR(100) not null,
    product_define_id VARCHAR(64) not null,
    product_code VARCHAR(24) not null,
    date_created TIMESTAMP not null,
    date_updated TIMESTAMP not null,
    attention_status INT4 not null,
    constraint PK_INVIMS_PRODUCT_ATTENTION primary key (product_attention_id)
    );
    
    comment on table invims_product_attention is
    '产品360_关注';
    
    comment on column invims_product_attention.product_attention_id is
    '关注的id';
    
    comment on column invims_product_attention.product_define_id is
    '产品的主键id';
    
    comment on column invims_product_attention.product_code is
    '产品编码';
    
    comment on column invims_product_attention.date_created is
    '创建时间';
    
    comment on column invims_product_attention.date_updated is
    '更新时间';
    
    comment on column invims_product_attention.attention_status is
    '关注状态:0 取消关注 1 已关注';
    
    /*==============================================================*/
    /* Index: Ix_user_umid */
    /*==============================================================*/
    create index Ix_user_umid on invims_product_attention (
    user_umid
    );
    
    /*==============================================================*/
    /* Index: Ix_product_define_id */
    /*==============================================================*/
    create index Ix_product_define_id on invims_product_attention (
    product_define_id
    );

    SERIAL  相当于自增。

    -- 创建sequence 序列,从1开始每次递增1,param_invims_product_attention_seq 是名称,不能重复
    create sequence param_invims_product_attention_seq start with 1 incrementby 1 no minvalue no maxvalue cache;
    -- product_attention_id 为自增的列
    alter tale public.invims_product_attention alter column product_attention_id set default nextval('param_invims_product_attention_seq')
  • 相关阅读:
    hihocoder 1388 Periodic Signal
    HDU 5880 Family View (AC自动机)
    HDU 5889 Barricade (bfs + 最小割)
    UVa 10806 Dijkstra, Dijkstra (最小费用流)
    POJ 3169 Layout (差分约束)
    差分约束系统学习
    HDU 3062 病毒侵袭持续中 (AC自动机)
    HDU 2896 病毒侵袭 (AC自动机)
    HDU 2222 Keywords Search (AC自动机)
    项目管理工具Leangoo,截止日期终于变绿色了
  • 原文地址:https://www.cnblogs.com/zhian/p/14080738.html
Copyright © 2011-2022 走看看