1. 程式人生 > >oracle資料庫建立表的基本語法

oracle資料庫建立表的基本語法

建立表的基本語法        create table 表名(           列名1  資料型別1,           .......           列名n  資料型別n         ) ;           表名  列名  命名規則         必須 首字母 是 字母 _  $          其他字母 是   字母 _  $ 數字 組合          表名列名最大長度 32位    4:刪除表  drop table  表名;       5:修改表結構  alter table  表名        1:新增列           alter table 表名
             add(  列名1  資料型別1,                      .......                    列名n  資料型別n);               2:修改列的資料型別              alter table 表名              modify( 列名1  新的資料型別1,                      .......                     列名n  新的資料型別n);                 3: 修改列的名稱                 alter table 表名
              rename column 列名 to 新的列名;        4:刪除列                   alter table 表名              drop  column  列名;        5:重命名錶            rename 表名  to 新的表名;     */  drop table t_user;  create table t_scottuser(      id number,      name varchar2(50),      pass varchar2(18),      status char(1),
     age number,      birthday  date  );  select * from t_user;  alter table t_user       add(sex char(2),           tel varchar2(18)           );   alter table t_user       modify(pass varchar2(30),              birthday timestamp               ) ;           alter table t_user     rename column name to userName;  alter table t_user    drop column tel;               rename t_user to t_sysUser;     select * from t_scottuser;