Database Design for Tags and URLs

I am creating a simple application for myself in JSP that stores the url for me and finds it based on tags. Why do I want to create a database. I am limited by my knowledge of SQL. But still I want to learn by doing.

I want to create a database that stores tags for the URL and the URL itself. A URL can contain text (50) or more in a column of a table (or any other sentence?). After saving the url, I want to link the tag (which again is text (50)?). Do tags and URLs need to be separated from the table? If so, how should I somehow link the URLs and tags to each other?

There may be a duplicate of my question, but I'm interested in developing my database (as explained above) and SQL syntax. So please suggest me how to proceed.

Am I coming the right way? Or do I need to think about a better database design? Any suggestions for creating a database?

+3
source share
2 answers

This looks like a candidate for many, many relationships; suppose a URL can contain more than one tag. This way you will have a tag table, a URL table and a url tag 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 will be.

+4
+2

Source: https://habr.com/ru/post/1718195/


All Articles