Stark
Stark

Reputation: 183

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?

Upvotes: 3

Views: 622

Answers (2)

powtac
powtac

Reputation: 41060

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

Upvotes: 2

Dan McClain
Dan McClain

Reputation: 11920

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.

Upvotes: 4

Related Questions