gpt4 book ai didi

sql - 无默认值的存储

转载 作者:行者123 更新时间:2023-11-29 07:15:00 24 4
gpt4 key购买 nike

有人可以向我解释以下方法的数据库设计会是什么样子吗:假设有两个表“玩具”和“愿望 list ”。每个愿望 list 都有一个玩具,但“玩具”并不包含世界上所有的玩具。为了防止 child 不高兴,让我们在名为“杂项”的玩具中添加一行,以便他们可以在文本输入中指定他们喜欢的玩具,这就是问题开始的地方。我不知道在哪里存储这些数据。

最佳答案

我想你自己回答了:

(assuming only one wishlist per customer)

wishlist_items
- customer_id
- toy_id

toys
- toy_id
- description
- type (permanent / customer-defined)

因此,当客户要求购买未知玩具时,您只需将其写入玩具 list 即可。

关于sql - 无默认值的存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1892854/

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