Oracle 命令

1、常用命令
1、 conn scott/123456 连接
2、 disc 断开
3、exit 退出
4、password 改密码
5、show user 显示当前用户名
6、 & 替代变量 select * from emp where job=’&job’;
7、 edit 编辑edit d:\a.sql
8、 spool spool d:\a.sql spool off
9、 linesize show linesize set linesize 20
10、 pagesize 与linesize类似

=========================================================================
2、创建新表
1、 create user 用户名 identified by 密码
2、 alter user 用户名 identified by 新密码
3、 grant resource to tea 授权
4、 grant connect to tea
5、 grant dba to tea
6、 grant all on scott.emp to tea With grant/admin option 把得到的对象/系统权限分给别
7、 drop user 用户名【cascade】删除用户
8、 revoke resource from tea 回收权限

3、表的管理

建一个表
Create table stuid number,name nvarchar2(20),sex nvarcha2r(4),birthday date,fellship number,resume nvarchar2(5));
1、增加
alter table stu add(score number);
2、删除
alter table stu drop(score number);
3、修改
alter table stu modify(resume nvarchar2(6));
重命名
Rename stu to student
4、查看
Select,name as名字,sex as 性别 from stu;

1、增加
Insert into stu values(1,“za”,“nan”,27-3月-2017,)
Insert into stu **(id,name)**values(3,“lisi”);
2、删除
Delect stu where id=3;
3、修改类型
Update stu set resume=‘2’where id=1;
Update stu set resume=null where id=1;
alter table stu modify(resume number);

update stu set sex=“男”name=“w”全部变
4、查找
Select count(*) from stu where sex=‘女’;
Select distinct name from stu;
Select (12*sal+nvl(bone,0))from emp where Ename=‘SMITH’;
模糊查询
Select * from emp where ename like (‘S%’);
Select * from emp where empno in (73620);
Select * from emp where mas is null;
Select * from emp order by sal desc;倒序

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值