1、建立表
create table chent2 (c varchar2(32) not null,user_name varchar2(32));
2、修改表結構(alter table 命令)
2.1修改列名(rename 命令)
alter table chent2 rename column ids to stuid;
-- 好像不可以一次修改多條列名,寫指令碼的暫時沒試過
2.2 修改列屬性(modify)
alter table chent2 modify (user_name varchar(32));
-- 可以一次多個列屬行
alter table chent2 modify (user_name varchar(180),stuid char(32));
2.3增加列(add)
alter table chent2 add(age char(3),address varchar(180));
2.4 刪除表中的列
alter table chent2 drop column age;
2.5修改表名(alter table 命令)
alter table chent2 rename to chentest;
3、刪除
3.1刪除資料表(drop)
create table t_drop (ids varchar2(32) not null,user_name varchar2(32));
drop table t_drop;
drop 執行後表資料和表結構都將刪掉
如果資料表的某些列別其他表引用,比如外來鍵啦,此時需要使用 cascade constraints;drop table t_drop cascade constraints;
oracle操作的基本命令
1.oracle 1 啟動 監聽 lsnrctl start 2 進入sqlplus介面 sqlplus nolog sql conn sys jiaxiaoai orcl as sysdba 3 啟動資料庫例項 sql startup 4 檢視當前所有的資料庫 select from v data...
oracle基本命令
1 describe查詢表結構 describe xuesheng 名稱 空值 型別 id number 38 xing ming varchar2 25 yu wen number shu xue number 2 select 列名稱 from 表名稱 select from xuesheng ...
oracle基本命令
sqlplus 鏈結oracle資料庫 sqlplus as sysdba 1 檢視當前的資料庫檔案一般都是放在 select name from v datafile 2 建立表空間 create tablespace 表空間名 datafile 對應的檔名 size 大小 3 建立使用者 cre...