1.set linesize 5;set pagesize 5
2.普通用户没有创建用户的权限,创建用户必须使用sys或者system账户,
创建用户命令:create user imdou8 identified by itlxh784533;
3.修改密码:passw system然后输入口令itlxh78453312.drop profile myprofile;
13.增加一个表的字段:alter table table_name add(字段名 类型);
14.更改一个字段:alter table_name modify(字段名 类型);[如果表中已存在数据,不建议改变字段,这种方式只针对空的表,都则可能会引发严重的问题]
15.修改一个表的名字:rename table_name to new_table_name;
16.删除表:drop table table_name;
17.删除一个字段 alter table table_name column column_name;
18.更改日期的格式:alter session set nls_date_format='yyyy-mm-dd';
19.插入部分字段:insert into table_name(column_name) values(value);
20.查询值为null的记录;select * from table where column_name is null;
21.修改一个字段的记录:update table_name set column_value where 查询条件;
22.修改多个字段:update table_name set column_value,column2_value where 查询条件;
23.设置回滚点:savepoint point_name;
24.回滚命令:rollback point_name;
25.按照日期查询例子:select hiredate,ename from emp where hiredate>'1978/2/2';[注意年月日的格式]。
26.多条件查询:select ename sal from emp where sal>2000 and sal<2500; select * from emp where (sal>500 and job like 'MANA%')and ename like 'J%';
27.like查询操作,%代表0到多个字符,_代表一个字符;
28.查询多个可能性的职员:select ename,sal from emp where sal in(2400,2300,2600);
29.order by关键字,select * from emp order by sal;默认为asc也就是从低到高排序.select * from emp order by sal desc;从高到底排序。
30.按部门从低到高,按工资从高到低排序:select * from emp order by deptno asc,sal desc;
31.使用别名排序:select ename,sal*13 "年薪" from emp order by "年薪" desc;
32.函数为条件查询:select ename,sal from emp where sal=(select max(sal) from emp);
33.计算工资大于平均工资的员工信息:select * from emp where sal>(select avg(sal) from emp);
34.查找每个部门每个职位的最高工资 平均工资:select * from(select avg(sal),max(sal),deptno,job from emp group by job,deptno) order by deptno;
35.多表查询:select a1.ename,a1.sal,a2.dname from emp a1,dept a2 where a1.deptno=a2.deptno;