I'm currently trying to convert the functionality of my website from utilizing nested for loops and text files to utilizing a MySQL database.
The database contains the following tables:
---------------------
Items---------------------
Item_ID
Item_Name
---------------------
Tags---------------------
Tag_ID
Tag_Name
---------------------
Items_Tags---------------------
Item_ID
Tag_ID
---------------------
How do I create the following queries?- Return the names of all items that have 4 or more of the same tags as an item named 'x'.
For example, say an item x has tags a,b,c,d,e,f and item y has tags a,b,c,d then i need to return y and others that have at least 4 of the same tags as x
- Return the names of the tags that 2 items have in common
Expanding on the one above, using x and y, return a,b,c,d since they have those in common
- Return the names of the items that have the following tags 'a','b','c'
x and y would be returned because they have a,b,c as tags
I've been trying to get these working for awhile so if you can help me out, I'll really appreciate it. If the query you provide works how I need it to, then I'll give you 5fg per working query. Thanks!