zoukankan      html  css  js  c++  java
  • Oracle创建表和创建序列和修改,增加sql字段

    一。创建表

      create table y_parts_classify(

        pt_id number(10) not null,

        pt_name varchar2(1000),

        update_time date default sysdate,

        create_time date default sysdate

      )

    二。修改,和增加,删除sql字段

      alter table y_parts_classify modify(

        pt_name varchar2(800)

      )

      alter table y_parts_classify add(

        remark varchar2(1000)

      )

      删除字段的语法:alter table tablename drop (column);

        说明:alter table 表名 drop column 字段名;

           例:alter table sf_users drop column HeadPIC;

    三。Oracle给字段增加说明。备注

      语法:comment on column TableName.ColumnName is '备注'

      例子:comment on column y_parts_classify.pt_id  is '配件分类id'

    四。Oracle创建序列

      create sequence seq_parts_classify 

      minvalue 1

      nomaxvalue 

      start with 1

      increment by 1 

      nocycle

      nocache

    五,从虚拟表查询

      select seq_parts_classify.nextval from dual 

    六.字段和表的重命名

    字段的重命名:

    说明:alter table 表名 rename  column  列名 to 新列名   (其中:column是关键字)

       例:alter table sf_InvoiceApply rename column PIC to NEWPIC;

    表的重命名:

    说明:alter table 表名 rename to  新表名

       例:alter table sf_InvoiceApply rename to  sf_New_InvoiceApply;

  • 相关阅读:
    UML 类之间的关系
    [noi.ac省选模拟赛]第11场题解集合
    [CF1270F]Awesome Substrings
    [noi.ac省选模拟赛20200606]赌怪
    FFT,NTT入门
    [AHOI2017/HNOI2017]单旋
    [HNOI2016]最小公倍数
    [HNOI2016]树
    [HNOI2016]大数
    服务外包概论课程资料
  • 原文地址:https://www.cnblogs.com/lingtiaoti/p/9390005.html
Copyright © 2011-2022 走看看