You can leave the FK to some dimension tables as NULL if those dimensions are not known or not applicable. You just have to remember to use outer joins when you do your reporting query.
Alternatively, some people create a "none" and/or an "n/a" dimension record for data mart dimensions and then populate fact table FKs to point at these rather than using NULLs. People who do this like this approach because they have an aversion to outer joins.
People who use NULL FKs in fact tables usually have an aversion to people who have an version to outer joins. ;) (in other words, this is a stylistic issue which can generate religious wars)
I say do whichever you prefer, but pick one approach and stick to it fervently.
What you could do is a design like this:
Product(id,name,description,price,productType)
ProductAttribute(productId,attributeName,value)
Then you would have the possibility to filter for all attributes that are currently used in your database.
If you want to be able to filter for all attributes, even if they are not used in any product at the moment, you'll have to add a table
AttributesForProductType(productType,attributeName)
which contains all possible attributes, and then set up referential integrity (foreign keys) between AttributesForProductType and ProductAttribute. This way you lose the risk of misspelling an attribute name in the ProductAttribute table.
edit: If you take this design this also solves your second question: How to display a details page for every possible product type?
All possible attributes for this product are
select attributeName
from AttributesForProductType
where productType=?
all real attributes for a product with their values are
select attributeName, value
from ProductAttribute
where id=?
and those combined are (off of my head, untested)
select apt.attributeName, pa.value
from Product as p
left outer join AttributesForProductType as apt on p.productType=apt.ProductType
left outer join ProductAttribute as pa on apt.attributeName=pa.attributeName
where p.id=?
Best Answer
This is bad - it is a table scan
But thousands of rows is not much
Best would be to have second table with phone
if you don't want to fix the data design then two column with = will be faster