Oracle基本SQL操作

1、創建用戶並賦予權限(sqlplus / as sysdba)

創建用戶
create user Scaffold identified by Scaffold;

創建一個表空間
create tablespace Scaffold datafile '/app/oracle/oradata/OFSAA/Scaffold.dbf' size 1000M;

表空間分配給用戶

alter user Scaffold default tablespace Scaffold;

sql語句來查看一下所有用戶所在的表空間
select username,default_tablespace from dba_users;  

用戶分配權限
grant create session,create table,create view,create sequence,unlimited tablespace to Scaffold;

 

2、創建表語句及對錶操作

--創建表
create table classes(
       id number(9) not null primary key,
       classname varchar2(40) not null
)      
--查詢表
select * from tablename;

--刪除表
drop table students;

--修改表的名稱
rename alist_table_copy to alist_table;

--插入數據
insert into tablename values(class_seq.nextval,'軟件一班')

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章