标签和 URL 的数据库设计

发布于 2024-08-05 19:53:15 字数 357 浏览 3 评论 0原文

我正在 JSP 中为自己构建简单的应用程序,它为我存储 URL 并根据标签查找它。我想为此设计一个数据库。我对 SQL 的了解有限。但我仍然想边做边学。

我想创建存储 URL 标签和 URL 本身的数据库。 URL 可以是表列中的文本(50) 或更多(或任何其他建议?)。存储 URL 后,我想关联一个标签(又是 text(50) ?)。我需要将标签和 URL 从表中分离出来吗?如果是这样,我应该如何以任何方式将 URL 和标签相互关联

我的问题可能重复,但我关心我的数据库设计(如上所述)和 SQL 语法。所以请建议我如何继续。

我的做法正确吗?或者我需要考虑更好的数据库设计? 关于数据库设计有什么建议吗?

I'm building simple application for myself in JSP which stores URL for me and finds it based on tags. For which i want to design a database. I'm limited with my knowledge of SQL. But still i want to learn by doing.

I want to create database that stores tags for the URL and the URL itself. The URL could be text(50) or more in a table column (or any other suggestion ?). After storing the URL I want to associate a tag ( which is again text(50) ?). Do i need to separate the tags and URL from table? If so how should I associate URL and tags to each other in any way?

There could be duplicate of my question, but I'm concerned with my database design (as explained above) and SQL syntax. So please suggest me how to proceed.

Am I proceeding the right way? Or do I need to think of a better database design?
Any suggestions about database design?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

溺ぐ爱和你が 2024-08-12 19:53:15

这看起来像是一种多对多关系的候选者,假设一个 URL 可以有多个标签。这样,您将拥有一个标签表、一个 url 表和一个标签-url 关联表。

至于URL的长度,则视情况而定,本题的URL是76个字符。您需要查看最长的网址是什么。

This seems like a candidate for a many to many relationship, assume that a URL can have more than one tag. That way, you would have a tags table, a url table and a tags-url correlation table.

As for the length of the URL, it depends, the url for this question is 76 characters. You need to see what your longest url may be.

自找没趣 2024-08-12 19:53:15

有一个名为 Tagschema 的数据库模式: http://forge.mysql.com /wiki/TagSchema

There is a DB schema called Tagschema: http://forge.mysql.com/wiki/TagSchema

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文