只要有数据库说什么是如此。
yn = yes,no
age_range = 0-4,4-6,6-12,...
use = Fine-Drawing,Canoeing,...
surface_group = All,PaperOrSkin,PaperOrWall,...
PRODUCT(p,n) -- product [p] is named [n]
TOY(p,AgeGroup,Toxic,ChristmasSpecial,...)
-- [p] is a toy for age range [AgeGroup] and whether it's toxic is [Toxic] and whether it's on Christmas special is [ChristmasSpecial] and ...
SCHOOL-STATIONERY(p,BulkAvailability,...)
-- [p] is school stationery and its bulk availability is [BulkAvailability] and ...
ART-ACCESSORY(p,Use,CompatibleSurface,...)
-- [p] is an art accessory with use [u] and is compatible with surfaces in surface group [CompatibleSurface] and ...
SQL查询结合了条件和表。查询的含义是从条件和上面给出的表格含义组合而成的。
请参阅this stackoverflow post from today或在EAV和OTLT上的其他无数人。 Or this.另外,只要了解数据库设计。也许开始here。如果是/否的选择分离
注意的事情是简单的:
TOY(p,AgeGroup,...) -- [p] is a toy for age range [AgeGroup] and ...
TOY-TOXIC(p) -- toy [p] is toxic
TOY-XMAS-SPECIAL(p) -- toy [p] is on Christmas special
SCHOOL-STATIONERY(p,...) -- [p] is school stationery and ...
SCHOOL-STATIONERY-BULK-AVAILABLE(p) -- school stationery [p] is available in bulk
也许你也想有时不具备的东西群体标签,但简单地陈述有关的事物或第一个和最后的东西范围:
age = 0,1,2,...
surface = Paper,Skin,Wall,...
TOY(p,...) -- [p] is a toy and ...
TOY(p,MinAge,MaxAge) -- [p] is a toy with age minimum [MinAge] and maximum [MaxAge]
ART-ACCESSORY(p,Use,...) -- [p] is an art accessory with use [u] and ...
ART-ACCESSORY-COMPATIBLE-SURFACE(p,CompatibleSurface) -- accessory [p] is compatible with surface [CompatibleSurface]
您可以随时更改当前硬连线信息(类型集和类型,列和表名称)。您始终可以编写通用查询,它们甚至不知道什么是硬连线,因为所有硬连线名称都是构成DBMS元数据的表中的值。