oracle 10g基础操作表
1创建新表
1.1从查询到的表创建表
create table temp as select stuName,stuNo,stuSex from stuInfo where stuAge>25;
1.2创建新表
/*学生信息表*/
create table stuInfo(
stuName varchar2(10) ,
stuNo varchar2(10),
stuSex varchar2(4),
stuAge number(2),
stuSeat number(10),
stuAddress varchar2(400));
/*学生成绩表*/
create table stuMark(
examNo varchar2(10),
stuNo varchar2(10),
writtenExam number(4),
labExam number(4));
2 修改表
2.1 增加字段
alter table stuInfo add(Zip number(6));
2.2 删除字段
alter table stuInfo drop column Zip
2.3 修改字段类型
alter table stuInfo modify(Zip varchar2(6));
2.4修改字段大小
alter table stuInfo modify(Zip number(4));
2.5 删除表
drop table stuInfo
3约束
3.1添加约束
alter table stuInfo add constraint PK_stuNo primary key(stuNo);
alter table stuInfo add constraint CK_stuSex check(stuSex in('男','女'));
alter table stuInfo add constraint CK_stuAge check(stuAge between 15 and 40);
alter table stuInfo add constraint CK_stuSeat check(stuSeat between 1 and 30);
alter table stuMark add constraint PK_ExamNo_stuMark primary key(examNo);
alter table stuMark add constraint FK_stuNo_stuMark foreign key(stuNo) references stuInfo(stuNo);
select stuName,decode(stuSex,'男','男同志'),
(stuSex,'女','女同志')
from stuInfo;
alter table stuInfo modify(stuSex not null);
3.2删除约束
3.2.1删除普通约束
alter table stuInfo drop constraint CK_stuSex;
3.2.2删除被外键参照的主键约束
alter table stuInfo drop primary key PK_StuNo
4索引
4.1创建索引
create index stuName_index on stuInfo(stuName);
4.2删除索引
drop index stuName_index;
5创建序列
5.1 创建序列
create sequence stuSeat_identity
minvalue 1
maxvalue 99999999
start with 1
increment by 1
cache 2
5.2触发器实现字段列自增长
相关文档:
初学linux+oracle,采用的本地虚拟机安装linux的方式,版本是Red Hat 5,唯一跟虚拟机安装其他系统不同的是:定制,选IDE硬盘,否则安装过程提示找不到硬盘失败。
本文重点是Oracle安装过程,版本 10.1.0。
3、安装相关的开发包(rpm包):
rpm -q binutils co ......
This course is aim to train the great DBA with good English speaking.
In recent years, more demands of Oracle DBA, but most of Senior DBAs are required to speak good English.
English has become the great barrier for more peoples in their career development, you must have the deep feeling about it ......
Union,对两个结果集进行并集操作,不包括重复行,同时进行默认规则的排序;
Union All,对两个结果集进行并集操作,包括重复行,不进行排序;
Intersect,对两个结果集进行交集操作,不包括重复行,同时进行默认规则的排序;
Minus,对两个结果集进行差操作,不包括重复行,同时进行默认规则的排序。
可以在最 ......
1、用dblink链接oracle
(1)与平台无关的写法:
create public database
link cdt connect to apps
identified by apps using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.31.205.100)(PORT = 1541))
)
(CONNECT_DATA =
(SERVICE_NAME = CDT)
)
)'
(2)可以将单引号内的内容 ......
一。查看oracle数据库是否为归档模式:
1.select name,log_mode from v$database;
NAME LOG_MODE
------------------ ------------------------
QUERY NOARCHIVELO ......