【雪野实训记录】Oracle数据库 T1作业——Oracle入门

--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;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值