我目前正在開發一個數據庫,它將容納很多物品,並且想知道哪種設計會更好,因爲每個類別有1000到10000個物品。電子商務數據庫設計
數據庫設計#1
Login Details
--------------
-userID
-Username
-Password
- ETC....
User Settings
--------------
-userID
-Setting 1
-Setting 2
-Setting 3
- ETC....
Product Category
-----------------
-ID
-Name
ALL Items
-----------
-ItemID
-Name
-Description
-Price
-Info
- ETC....
-parentCategoryID
OR
數據庫設計#2
Login Details
--------------
-userID
-Username
-Password
- ETC....
User Settings
--------------
-userID
-Setting 1
-Setting 2
-Setting 3
- ETC....
Product Category
-----------------
-ID
-Name
-tableName
Electronics
-------------
-ItemID
-Name
-Desc.
-Price
- ETC....
Food
-------------
-ItemID
-Name
-Desc.
-Price
- ETC....
Books
-------------
-ItemID
-Name
-Desc.
-Price
- ETC....
Apparel
-------------
-ItemID
-Name
-Desc.
-Price
- ETC....
Others
-------------
-ItemID
-Name
-Desc.
-Price
- ETC....
我可以硬編碼一個包含數據庫名稱的文件,但是對於選項1,數據庫中的1個表格可以有10個類別的〜1m個項目(共計〜1000萬個)項目可以正常工作? – Steven10172
需要知道什麼樣的查詢將是常見的。 – smk
搜索:「項目名稱」「項目名稱和類別」「isbn(books)」和搜索搜索也可以按價格排序 – Steven10172