Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Product
- ProductId*
- CategoryId: FK to Category.CategroyId
- Name
- Category
- CategoryId*
- Name
- Property
- PropertyId*
- Name
- Type
- CategoryProperty
- CategoryId*: FK to Category.CategoryId
- PropertyId*: FK to Property.PropertyId
- ProductProperty
- ProductId*: FK to Product.ProductId
- PropertyId*: FK to Property.PropertyId
- ValueAsString
- SELECT
- Product.ProductId,
- Product.Name AS ProductName,
- Category.CategoryId,
- Category.Name AS CategoryName,
- Property.PropertyId,
- Property.Name AS PropertyName,
- Property.Type AS PropertyType,
- ProductProperty.ValueAsString
- FROM
- Product
- INNER JOIN Category ON Category.CategoryId = Product.CategoryId
- INENR JOIN CategoryProperty ON CategoryProperty.CategoryId = Category.CategoryId
- INNER JOIN Property ON Property.PropertyId = CategoryProperty.PropertyId
- INNER JOIN ProductProperty ON ProductProperty.PropertyId = Property.PropertyId
- AND ProductProperty.ProductId = Product.ProductId
- WHERE
- Product.ProductId = 1
- tProduct
- productID
- <other product details>
- tCategory
- categoryID
- <other category details>
- tProperty
- propertyID
- <other property details>
- tProductXCategory
- productyID
- categoryID
- tCategoryXProperty
- categoryID
- propertyID
Add Comment
Please, Sign In to add comment