数据表设计思想,ER图及三范式。

数据表设计思想

设计流程

需求分析:根据用户的需求,分析出需要记录的数据

需求设计:根据分析出的数据,设计E-R模型图

详细设计:将E-R模型图转换成数据表

三大范式:使用数据库三大范式的设计思想对数据表进行审核

E-R模型图

概念:Entity-Relationship,实体关系图

组成元素:

举例,将下面三张表用E-R模型图表示出来

 

三大范式

概念:三大范式是数据库的一种设计规范,主要用来检查我们的数据库是否存在冗余数据。

第一范式:每一列都具有原子性,也就是不能再分割

 

第二范式:要求每一个表,只描述一件事情

第三范式:要求表中不存在冗余字段

create table Score

(

         sId int primary key auto_increment,

         studentId int not null,

         english float,

         math float

)

create table teacher

(

         tId int auto_increment primary key,

         tName varchar(50) not null,

         tSex char(2),

         tAge int,

         tSalary decimal

)

create table Class

(

         cId int auto_increment primary key,

         cName nvarchar(50) not null,

         cDesciption text

)


create table Student

(

         SId int auto_increment primary key,

         SName varchar(50),

         SGender char(2) not null,

         SAddress varchar(300),

         SPhone varchar(100),

         SAge int,

         SBirthday datetime,

         SCardId varchar(18) null,

         SClassId int not null

)

 

  • 9
    点赞
  • 46
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值