I have a article website and each article has some tags. How should be my database structure?

This is my article table (article):

article_id (key)  |  article_content  |  article_title  |  article_lang_id

This is the list of my tags (tag_list):

tag_list_id (key)  |  tag_list_name  |  tag_list_description

And this is my tag table (tag_link):

  tag_id (key)   |   article_id (f-key)  |   tag_list_id (f-key)

I echo the article content with php, how can I echo (I mean showing tag bellow content) tags bellow the content?

This is my question:

1- How can I show each content tags near content?

(each content can has less than 5 tags)

2-What is the MYSQL query that I can run to select my tags with content? (is there any professional MySQL orders to select content with tags form tag_link and then select the name of tag from tag_list and then show it near article, can I do it with MySQL orders like join, having, on and several other? How?)

3-Is my database structure for tagging true?

(I can do this with php variables and ... , but I need to do it by MySQL)

1 Answer 1


1 & 2:use inner join

SELECT column_name(s)
FROM table1
ON table1.column_name=table2.column_name;

3: yes your structure is true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.