在SQL / MySQL中,有没有将同一表中的一对一关系放在一起的原因? [英] In SQL / MySQL, are there reasons not to put one-to-one relationship in the same table?

查看:136
本文介绍了在SQL / MySQL中,有没有将同一表中的一对一关系放在一起的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一对一的关系通常可以存储在同一个表中。是否有理由不将它们存储在同一张表中?

One-to-one relationship could usually be stored in the same table. Are there reasons not to store them in the same table?

推荐答案

列的数量和类型。表中列的大小有限制。请参阅 here 。每行最多有8060个字节。

Number and type of columns. There is a limit on the size of the columns in a table. See here. There is a maximum of 8,060 bytes per row.

非常大的表格也会影响性能,难以优化和索引。

Very large tables can also affect performance and can be difficult to optimize and index well.

除了保持数据在概念上是不同的,除了彼此之外。例如,一个国家和货币有1到1个关系(说明性的例子,我知道并不总是这样)。我仍然不会把他们放在一起。

This is apart from keeping data the is conceptually different, apart from each other. For example, a country and currency have a 1 to 1 relationship (illustrative example, I know this is not always the case). I would still not keep them together.

这篇关于在SQL / MySQL中,有没有将同一表中的一对一关系放在一起的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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