相关疑难解决方法(0)

如果字段名称暗示关系,是否为父/子关系?

我正在使用协调系统并尝试在 MySQL 数据库中对其进行编目。这例如像这样工作

01  LIVE ANIMALS
0101  horses, asses, mules and hinnies, live
0102  bovine animals, live
0103  swine, live
010310  Purebred breeding animals
010391  Weighing less than 50 (11023 lb) each
010392  Weighing 50 (11023 lb) or more each
0104  sheep and goats, live
0105  chickens, ducks, geese, turkeys, and guineas, live
0106  animals, live, nesoi Nesoi - not elsewhere specified of indicated.
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,有一个明确的父子关系。这种关系总是可以通过所使用的编号来追溯。从这个线程我了解到我最好使用文本数据字段作为代码(01、0101 等)。我的问题是:我应该在某处记录亲子关系,还是没有必要?毕竟,我可以做到:

SELECT * FROM accounts WHERE code LIKE '0103%'
Run Code Online (Sandbox Code Playgroud)

并获得所有子帐户就好了。而且我觉得父子表可能会使事情变得更复杂。但我想听听其他人的看法。

mysql relational-theory

0
推荐指数
1
解决办法
736
查看次数

标签 统计

mysql ×1

relational-theory ×1