ORALCE表基本操作

1.创建表空间

–用于查询现在有的表空间的存储位置
select * from dba_data_files;

–datafiele 替换成自己需要的存储位置
create tablespace ehc
logging
datafile ‘C:\oracle\oradata\Oracle11\ehc.dbf’
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;

–设置账号和密码
create user ehc identified by ehc default tablespace ehc;

–赋权限给设置好的账号
grant connect,resource,dba to ehc;

2.创建表,如:
create table tab_car_info(
car_id number not null,
car_no varchar2(20) not null,
car_color number(2),
company_id number,
car_economy_type number(4),
primary key(car_id)
)

–添加备注
comment on table tab_car_info is ‘车辆信息表’;
comment on column tab_car_info.car_id is ‘车辆id’;
comment on column tab_car_info.car_no is ‘车牌号’;
comment on column tab_car_info.car_color is ‘车牌颜色 1-蓝色,2-黄色,3-黑色,4-白,9-其它’;
comment on column tab_car_info.company_id is ‘所属车企’;
comment on column tab_car_info.car_economy_type is ‘经营类型’;

3.修改表字段
–字段重命名
alter table original_tableName rename column PIC to NEWPIC;

–删除字段
alter table rig drop column syscontplan ;

–添加字段
alter table rig add syscontplan varchar2(10) ;

–修改字段
alter table Tab_Elec_Point modify(car_type NUMBER(3));

4.修改表
–表重命名
alter table original_tableName rename to dest_tableName ;

创建序列
CREATE SEQUENCE SEQ_DEMO
INCREMENT BY 1
START WITH 1
NOMAXvalue
NOCYCLE
NOCACHE;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值