Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design for tags and URL

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?

like image 646
Stark Avatar asked Jan 28 '26 14:01

Stark


1 Answers

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.

like image 105
Dan McClain Avatar answered Jan 31 '26 07:01

Dan McClain