java开发中的总结 大家可以看看哦
employee modify (comm number(10));(修改列)
select * from all_col_comments;(查找所有列注释)
select * from user_col_comments;(操作当前用户的列注释)
select * from all_tab_comments;(查找所有表注释)
select * from user_tab_comments;(查找当前用户的所有表注释)
操作表:
truncate table guyuan;(删除表中的所有数据,并释放空间)
drop table guyuan;(删除表,不释放空间)
comment on table employees is 'Employees Information ';(为表添加注释)
DML操作语句:
insert into guyuan(employee_id,fast_name,hiredate,job_id,salary,commission,manager_id,department_id) values (1017,'Herry','25-6月-2012','业务人员',5000.00,5000,1012,40)(插入语句)
insert into othertable(employee_id,fast_name,hiredate,job_id,salary,commission,manager_id,department_id) select employee_id,fast_name,hiredate,job_id,salary,commission,manager_id,department_id from guyuan where job_id like '%开发';(从一个表复制多行到另一个表中)
update guyuan set job_id = '宣传员',salary = 5000 where employee_id = 1016;(更新雇员表)
update guyuan set department_id = (select department_id from guyuan where employee_id = 30) where employee_id = 1016(更新雇员表)
delete from guyuan where employee_id = 1016;(删除一行)
rollback;(对delete操作进行回滚)
commit;(对delete操作进行提交)
savepoint update_done;(以当前作为保存点)
rollback to update_done(当前点回滚)
delete from employee where empno = (select empno from employee where job = '教务主任')(子查询删除)
insert into employee(empno,ename,job,mgr,hiredate,sal,comm,deptno) values (1009,'小样儿',CCSTP,'31-8月-12',3000,300,default)(用default默认值)
数据库权限操作:
create user cui identified by cui;(建立新用户,角色)(密码不能是数字)
select * from dba_users;(查找所有用户)
select * from dba_users where username = 'CUI';(查找cui用户)
alter user exam identified by cui;
select * from dba_sys_privs where grantee = 'SCOTT';(查找scott的权限)
select * from scott.guyuan;(查找scott用户下的guyuan表)
create view guyuanview as select * from scott.guyuan;(建立视图view)
select * from guyuanview;(查找视图view)
drop user EXAM;(删除用户)
grant create table to CUI;(给用户CUI授权建表权力)
select * from dba_roles;(查找所有用户角色)
create role Admin;(建立新角色)
grant Admin to CUI;(将Admin角色授权给用户CUI)
grant select on employees to CUI(授予用户CUI中的表查找权限)
grant create session,create table,unlimited tablespace to CUI;(授予用户CUI会话,建表,对表无限制权限)
grant unlimited tablespace to CUI(对
CUI用户授予对表无限制权限)
revoke create table from CUI;(撤销用户CUI的建表权限)
grant select on scott.emp to scott
grant resource,connect to ABC;
日期格式化:(date-