oracle增删改查命令

本文主要介绍了Oracle数据库中进行数据增、删、改、查的基本命令,详细讲解了如何在scott/tiger用户环境下操作。
摘要由CSDN通过智能技术生成

1.增删改:

在这里插入图片描述

--创建表空间
create tablespace it

--创建数据文件
datafile 'e:\it.dbf'
size 100m
autoextend on
next 10m;

--删除表
drop tablespace it;


--创建用户
create user it
identified by it
default tablespace it;

--授权用户
grant dba to it;

--创建表
create table account(
 name varchar2(10),
 id number(20)
);

--修改表结构
--添加一列
alter table account add(gender number(1));

--修改列类型
alter table account modify gender char(1);

--修改列名称
alter table account rename column gender to sex;

--删除一列
alter table account drop column sex;


--注意:凡是涉及到增删改,都需要手动commit(不提交即时查询不出来的)
--添加一条记录

insert into account(name ,id) values('keke',s_it.nextval);
commit;

select* from account;
--修改一条记录
update account set name='ll' where id=90;
commit;

--删除表结构
--三种方式,注意特点

--删除表中全部记录
delete from account;

--删除表结构
drop table account;

--先删除表&
  • 0
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值