☆ 运行 oracle10g : 在运行中输入-----sqlplus /nolog---注: 运行oracle并且不登陆;
☆ 启动isqlplus : 在浏览器中输入
☆ Oracle 连接身份 :1.normal(默认)
2.sysoper系统操作员
3.sysdba 系统管理员
☆ oracle默认帐户: sys和system 其中sys登录必须加as sysdba 或者as sysoper 例如:
conn sys/orcl as sysdba
☆ 登录oracle数据库: conn 用户名/密码 as 连接身份
☆ show user;-----------显示当前用户
☆ 创建用户:create user 用户名 identified by 密码;
☆ 赋予权限:grant dba to 用户名;----赋予该用户dba权限
☆ @F:\数据库文件\演示数据库数据.sql;-------加载脚本生成数据
☆ drop user 用户名 cascade;----删除用户
☆ 查看表结构:desc student;
☆ 查看表中内容: select * from 表名;
☆ set linesize 200;----一行显示200个字符
set pagesize 200;----一列显示200个字符
set wrap off;--------如果一行超出200个字符,多余的字符将截断
☆ select语句中接的几个关键字:where、between and 、in、 like 、is null ;
☆ 比较运算符: >,<,<=,>=,=,<>不等于
☆ 查询中where后接条件: select sname from student where sage=16;
☆ between ...and...(否定在between前面加not)
例:------------雇用日期在21-9月 -89到28-9月 -97之间的人
select first_name from employees
where hire_date between '21-9月 -89' and '28-9月 -97';
☆ in(否定就是在in前面加not)
select first_name,salary from employees
where salary in (6000,9000,10000,15000);
☆ like(否定就是在like前面加not)
%代表任意个字符 _代表任意一个字符
select first_name,salary from employees where first_name like 'A%e_';
☆ is null(否定是is not)
null 不是值,是一个非分配,未知的状态
select first_name,salary,commission_pct from employees
where commission_pct is null;
☆ order by 排序关键字
select sname,ssex,sage from student where ssex='男' order by sage desc;
降序用desc 升序 用 ASC 默认是 升序
注意:排序null在降序排在最上,升序排在最下(就当它最大)
阅读(233) | 评论(0) | 转发(0) |