02.oracle常用命令

02.oracle常用命令

切换用户:

conn scott/tiger

展示当前用户:

show user

修改当前用户的密码:

passw

查询所有的表:

select * from tab;

格式化数据:

set pagesize 50;
set linesize 200;

切换管理员账户:

conn sys/root@orcl as sysdba;

查看某个归属某个人的表:

select * from scott.emp;(select *  from user.table;)

解锁用户:

alter user scott account unlock|lock;

给表添加注释:

comment on table emp is '雇员表';

给表中的列添加注释:

comment on column emp.ename is '雇员名称';

查询语句

-- 查询语句
select [distinct] [*,colum alias,...] from table alias where 条件表达式
-- 例子
-- 查询员工表中部门编号设计
select EMPNO,ENAME,JOB from emp where DEPTNO = 10;
-- distinct 去重查询
select distinct DEPTNO from emp;
-- 查询过程中可以个列添加别名
select e.EMPNO 雇员编号,e.ENAME as 雇员名称,e.JOB 雇员工作 from EMP e where e.DEPTNO = 10;
--查询所有的字段可以使用*;但是在项目中不要使用
select * from EMP;

猜你喜欢

转载自blog.csdn.net/Bruce_Zhang0828/article/details/112720202