很长时间不写博客了,最近一直在忙这学校的比赛都忘记更新博客了。新的任务又要开始了,我们要准备《2017年中国大学生计算机设计大赛软件服务外包竞赛》。这次不能再想像之前那样有PC端的功能作为参考,这次真的是要做到从无到有了,虽然过程肯定有点困难,但是想到如果能成功的话肯定是获益匪浅的。今天就是我开战的第一天,分析功能建立数据库,不知道数据库建立的是否完美但是在这次的建立数据库中真的是学到了之前没有学到的知识。下面我就把这次遇到的问题写下来,然后是我的解决方法希望可以帮助到遇到同样问题的你。
首先,我用的软件是:

接下来是我们的数据库E-R草图:

下面就开始着手用软件建立数据库,下面是我们根据E-R图建立的表结构图:

admin表设计为:

department表设计为:

meet表设计为:

room表设计为:

source表设计为:

staff表设计为:

是不是觉得我已经建立好了呢?其实我也觉得我建好了,直到我的学弟问了我一个问题我才发现我没有注意到的一些细节。接下来是我截得是他建立数据库出现的问题,也是我没有注意到的细节。

看见那个问号了,这个是编码不一致导致的。点击表名会出现下面的图片显示结果:对照一下看你的编码方式是不是utf-8?

默认状态字符编码是Latin1:

如果不是的话,这个时候需要设置一下编码格式为utf-8。但是在数据库开启的状态下是无法改变数据库编码格式的,只有在关闭状态下才可以。
但是改过编码方式之后你的表格显示的还是乱码那是因为这个:单击你建立的属性看属性的编码方式是不是不是utf-8,如果不是改过来说就可以了。

通过上面的方法我们最终的结构为:

数据库类型:


bigint(存储字节为8个字节)
一个字节 占 8 位二进制,所以取值范围为:
从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型数据(所有数字)。存储大小为 8 个字节。
int(存储字节为4个字节)
取值范围为:
从 -2^31 (-2,147,483,648) 到 2^31 - 1 (2,147,483,647) 的整型数据(所有数字)。存储大小为 4 个字节。int 的 SQL-92 同义字为 integer。
smallint(存储字节为2个字节)
取值范围为:
从 -2^15 (-32,768) 到 2^15 - 1 (32,767) 的整型数据。
tinyint(存储字节为1个字节)
从 -127到 128 的整型数据。
存储Boolean类型的值得话类型选bit。
|