只要有數據庫說什麼是如此。
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元數據的表中的值。