gpt4 book ai didi

SQL 数据库模型 : Multiple artists on single song

转载 作者:行者123 更新时间:2023-12-05 01:49:44 27 4
gpt4 key购买 nike

我想知道当给定歌曲有多个艺术家时,最好的建模方法是什么。

id   song_title           artist
=================================================
1 Battle Sirens Knife Party, Tom Morello
2 Internet Friends Knife Party
3 Satisfy Nero

我最终希望它像这样工作的地方:

id   song_title           artist
=================================================
1 Battle Sirens [1,2]

像这样的艺术家表:

id   artist_name        
===================
1 Knife Party
2 Tom Morello
3 Nero

对我来说,将每个艺术家字段作为包含艺术家 ID 数组的字符串是最有意义的:“[1,2]”,但这似乎不是仅在 SQL 中执行此操作的正确方法。

我唯一能想到的其他事情是:

  • 为具有任意标识符的艺术家组合创建一个新表。
  • 有一个 'assoc' 表,当它背后有两个艺术家时,同一歌曲 ID 有两条记录。

最佳答案

创建关联表是处理m:m关系的常规方式

关于SQL 数据库模型 : Multiple artists on single song,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73760205/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com