如何从Oracle中的表中选择多个值?

时间:2022-04-03 12:58:28

I have Users,Questions & Answers Table. A User can Post a question and can tag himself as well as the question upto 5 tags(eg:sql,java,html...). Do I need a separate table for Tags? if so how do I select tags from TAGS table for User and Questions posted by User.

我有用户,问题和答案表。用户可以发布问题并且可以标记自己以及最多5个标签的问题(例如:sql,java,html ...)。我需要一个单独的标签表吗?如果是这样,我如何从用户发布的用户和问题中选择TAGS表中的标签。

1 个解决方案

#1


0  

How are the tags stored? Comma-delimited data? There are ways to make it work but I would advise against storing them that way.

标签是如何存储的?以逗号分隔的数据?有办法使它工作,但我建议不要那样存储它们。

Whether you need a separate table for tags depends on whether you want to limit users and their questions to certain tags. If users are free to enter whatever tags they like, then no, you don't need a separate table for tags (unless maybe you want to save frequently-used tags or something like that).

是否需要单独的标记表取决于您是否要将用户及其问题限制为某些标记。如果用户可以*输入他们喜欢的任何标签,那么不,你不需要一个单独的标签表(除非你想保存经常使用的标签或类似的东西)。

I would strongly advise that you have separate tables for user tags and question tags rather than storing multiple tags in a single column in the user or question table.

我强烈建议您使用单独的用户标签和问号标签表,而不是在用户或问题表的单个列中存储多个标签。

#1


0  

How are the tags stored? Comma-delimited data? There are ways to make it work but I would advise against storing them that way.

标签是如何存储的?以逗号分隔的数据?有办法使它工作,但我建议不要那样存储它们。

Whether you need a separate table for tags depends on whether you want to limit users and their questions to certain tags. If users are free to enter whatever tags they like, then no, you don't need a separate table for tags (unless maybe you want to save frequently-used tags or something like that).

是否需要单独的标记表取决于您是否要将用户及其问题限制为某些标记。如果用户可以*输入他们喜欢的任何标签,那么不,你不需要一个单独的标签表(除非你想保存经常使用的标签或类似的东西)。

I would strongly advise that you have separate tables for user tags and question tags rather than storing multiple tags in a single column in the user or question table.

我强烈建议您使用单独的用户标签和问号标签表,而不是在用户或问题表的单个列中存储多个标签。