这个表的架构结构有什么不好 [英] what is bad in this table schema structure

查看:203
本文介绍了这个表的架构结构有什么不好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表结构如下:

`CREATE TABLE "pages" (
   "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
   "title" varchar(255),
   "body" varchar(255),
   "author" varchar(255), 
   "email" varchar(255), 
   "reference" varchar(255),
   "created_at" datetime,
   "updated_at" datetime);`

这个表格结构不好吗?

Is this table structure bad?

它正在使用的sqlite数据库。

Its sqlite database i am using.

推荐答案

根据您提供的有限信息。如果桌子适合你的需要,那么它不是坏的。

Based on the limited info that you have provided. If the table fits your needs then no it is not bad.

但是,如果您拥有多个条目的同一作者。您可能需要考虑从您的页面表中删除作者,并为作者提供单独的表格,然后在作者和页面之间使用外键关系。

However if you will have the same author with multiple entries. You might want to consider removing the author from your pages table and have a separate table for authors then use a foreign key relationship between authors and pages.

如果您对每个作者都有多个电子邮件,您可以使用电子邮件做同样的事情。

You could do the same thing with the email if you will have multiple emails for each author.

这篇关于这个表的架构结构有什么不好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆