I have a database with 3 tables - products, tags, & product_tags. I need a query that will return all of the products that have all of the specified tags. In other words, don't return the product if it does not have all of the specified tags.
products
+----+-----+--------+------------------------+
| id | uid | name | description |
+----+-----+--------+------------------------+
| 1 | p1 | ball | something that bounces |
+----+-----+--------+------------------------+
| 2 | p2 | block | for building stuff |
+----+-----+--------+------------------------+
| 3 | p3 | bucket | holds stuff |
+----+-----+--------+------------------------+
| 4 | p4 | shovel | scoops stuff |
+----+-----+--------+------------------------+
tags
+----+-----+--------+
| id | uid | name |
+----+-----+--------+
| 1 | t1 | blue |
+----+-----+--------+
| 2 | t2 | red |
+----+-----+--------+
| 3 | t3 | green |
+----+-----+--------+
| 4 | t4 | yellow |
+----+-----+--------+
| 5 | t5 | orange |
+----+-----+--------+
product_tags
+-------------+---------+
| product_uid | tag_uid |
+-------------+---------+
| p1 | t1 |
+-------------+---------+
| p1 | t2 |
+-------------+---------+
| p2 | t3 |
+-------------+---------+
| p2 | t4 |
+-------------+---------+
| p2 | t5 |
+-------------+---------+
| p3 | t1 |
+-------------+---------+
| p4 | t1 |
+-------------+---------+
| p4 | t5 |
+-------------+---------+
Here are some examples of results I'm looking for:
Select the products that are red (t2):
+-------------+------+
| product_uid | name |
+-------------+------+
| p1 | ball |
+-------------+------+
Select all products that are red & blue (t2, t1):
+-------------+------+
| product_uid | name |
+-------------+------+
| p1 | ball |
+-------------+------+
Select all products that are red, blue & yellow (t2, t1, t4):
+--------------------+
| NO PRODUCTS |
+--------------------+
Select all products that are blue (t1):
+-------------+--------+
| product_uid | name |
+-------------+--------+
| p1 | ball |
+-------------+--------+
| p3 | bucket |
+-------------+--------+
| p4 | shovel |
+-------------+--------+
Select all products that are blue & orange (t1, t5):
+-------------+--------+
| product_uid | name |
+-------------+--------+
| p4 | shovel |
+-------------+--------+
Here is a link to a SQLFiddle that's already set up. I tried a LEFT JOIN but it doesn't get me what I'm looking for.