【安博培训笔记】Oracle1 入门 作业20130909
2013-09-10 08:02
330 查看
--Oracle 入门 作业--
--创建一个名为DAVID的用户,口令为davidpass--
--并授予其连接数据库和创建表对象的权限。--
--同时授予其访问另一用户MARTIN的表TEST的权限.--
create user DAVID identified by davidpass;
grant connect to DAVID;
grant select on MAERIN.TEST to DAVID;
--bbsUsers用户表,存储注册的用户信息,用户注册后才能发贴和回贴--
--bbsTopic主贴表,存储主贴的内容--
--bbsReply跟贴表,存储跟贴的内容--
--bbsSection存储版块的信息--
create sequence bbs_seq
increment by 1
start with 1
maxvalue 999999999
nocycle
cache 10;
create table bbsUsers(
uuid int primary key not null,
upwd varchar2(20) default '888888' check(length(upwd)>=6),
usex char(1) default '1',
urdate date default sysdate,
ustate int default 0 not null,
ujb int default 1 not null,
ujf number default 20,
uemail varchar2(30) check(uemail like '%@%')
);
create table bbsSection(
sid int primary key not null,
sname varchar2(32) not null,
smasterID int references bbsUsers(uuid),
sprofile varchar2(20),
sclickCount int,
stopicCount int
);
create table bbsTopic(
tid int primary key not null,
tsid int references bbsSection(sid),
tuid int references bbsUsers(uuid),
treplyCount int,
tface int,
ttopic varchar2(20) not null,
tcontents varchar2(30) not null,
ttime date,
tclickCount int,
tstate int not null,
tlastReply date
);
create table bbsReply(
rid int primary key not null,
rtid references bbsTopic(tid),
rsid references bbsSection(sid),
ruid references bbsUsers(uuid),
rface int,
rcontents varchar2(20) check (length(rcontents)>6) not null,
rtime date,
rclickCount int
);
select * from bbsusers;
select * from bbsTopic;
select * from bbsReply;
select * from bbsSection;
drop table bbsTopic;
drop table bbsReply;
drop table bbsSection;
drop table bbsusers;
--创建一个名为DAVID的用户,口令为davidpass--
--并授予其连接数据库和创建表对象的权限。--
--同时授予其访问另一用户MARTIN的表TEST的权限.--
create user DAVID identified by davidpass;
grant connect to DAVID;
grant select on MAERIN.TEST to DAVID;
--bbsUsers用户表,存储注册的用户信息,用户注册后才能发贴和回贴--
--bbsTopic主贴表,存储主贴的内容--
--bbsReply跟贴表,存储跟贴的内容--
--bbsSection存储版块的信息--
create sequence bbs_seq
increment by 1
start with 1
maxvalue 999999999
nocycle
cache 10;
create table bbsUsers(
uuid int primary key not null,
upwd varchar2(20) default '888888' check(length(upwd)>=6),
usex char(1) default '1',
urdate date default sysdate,
ustate int default 0 not null,
ujb int default 1 not null,
ujf number default 20,
uemail varchar2(30) check(uemail like '%@%')
);
create table bbsSection(
sid int primary key not null,
sname varchar2(32) not null,
smasterID int references bbsUsers(uuid),
sprofile varchar2(20),
sclickCount int,
stopicCount int
);
create table bbsTopic(
tid int primary key not null,
tsid int references bbsSection(sid),
tuid int references bbsUsers(uuid),
treplyCount int,
tface int,
ttopic varchar2(20) not null,
tcontents varchar2(30) not null,
ttime date,
tclickCount int,
tstate int not null,
tlastReply date
);
create table bbsReply(
rid int primary key not null,
rtid references bbsTopic(tid),
rsid references bbsSection(sid),
ruid references bbsUsers(uuid),
rface int,
rcontents varchar2(20) check (length(rcontents)>6) not null,
rtime date,
rclickCount int
);
select * from bbsusers;
select * from bbsTopic;
select * from bbsReply;
select * from bbsSection;
drop table bbsTopic;
drop table bbsReply;
drop table bbsSection;
drop table bbsusers;
相关文章推荐
- 【安博培训笔记】Oracle2 基本SQL查询 作业20130909
- 【安博培训笔记】Oracle6 游标管理 作业20130911
- 【安博培训笔记】Oracle5 使用 PL/SQL 作业20130911
- 【安博培训笔记】Oracle4 事务和数据库对象 作业20130910
- 【安博培训笔记】Oracle7 子程序和程序包 作业20130914
- 【安博培训笔记】Oracle8 触发器 作业20130914
- 【安博培训笔记】Oracle3 操作符及SQL函数 作业20130910
- 【安博培训技术】Oracle1 入门 20130909
- 【安博培训技术】Oracle2 基本SQL查询20130909
- 【安博培训技术】Oracle3 操作符及SQL函数20130909
- 【安博培训笔记】Java 基础_下课作业1_20130920
- 【安博培训笔记】Java 基础_下课作业2_20130920
- 【安博培训笔记】Java2 数组、字符串、常用工具类_课下作业1_20130920
- 【安博培训笔记】Oracle聊天室-L1_阶段项目案例20130917
- 【安博培训笔记】Java2 数组、字符串、常用工具类_课下作业2_20130920
- 【安博培训笔记】Oracle销售员工资计算系统-L2_阶段项目案例20130917
- 【安博培训笔记】Oracle宾馆管理系统-TI_综合项目20130917
- Oracle高级培训 第2课 学习笔记
- oracle编程入门笔记2015-01-06--sqlplus
- [原]java专业程序代写(qq:928900200),学习笔记之基础入门<Oracle_基础>(三十三)