oracle建表,設置主鍵,修改屬性等


--建表
create table book(
       book_id number(10),
       book_name varchar2(20),
       book_price number(10,2),
       book_author varchar2(20),
       book_publish_time date,
       book_introduction varchar2(100)
);
--設置主鍵 constraint :約束 alter table book add constraint PK_ID primary key (book_id); --添加和刪除列 alter table book add book_remark varchar2(20); alter table book add( book_ext1 varchar2(20), book_ext2 varchar2(20) );
alter table book drop column book_ext1; --修改表名稱 alter table book rename to new_book; alter table new_book rename to book; --修改列名稱 alter table book rename column book_name to book_name_new; alter table book rename column book_name_new to book_name ; --修改字段屬性類型 alter table book modify book_name varchar2(40); --修改字段屬性默認值 alter table book modify book_name default 'green tale'; --刪除表 drop table book;

  建表時的參數:

create table AB_XIAOFSWJLB 
(
   ID                   VARCHAR2(90)         not null,
   MINGC                VARCHAR2(90)         not null,
   XIEZBM               VARCHAR2(90)         not null,
   SHIWNR               VARCHAR2(1024)       not null,
   RIQ                  CHAR(14)             not null,
   BEIZ                 VARCHAR2(300),
   GUANLRYJ             VARCHAR2(300),
   SHENCRID             VARCHAR2(90),
   SHENCR               VARCHAR2(90),
   SHENCZT              VARCHAR2(90),
   SHENCRQ              CHAR(14),
   JILRID               VARCHAR2(90),
   JILR                 VARCHAR2(90),
   JILRQ                CHAR(14),
   CORPID               VARCHAR2(90)         not null,
   DEPID                VARCHAR2(90)         not null
)
pctfree 10
initrans 1
storage
(
    initial 64K
    minextents 1
    maxextents unlimited
)
tablespace USERS
logging;

  http://blog.itpub.net/17203031/viewspace-688011/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM