开发者

Does any (R)DBMS exist that supports Linked Lists?

Are there any commercial databases that support data types pointing to the root node of say a linked list?

For example, I was thinking about the design for a basic ORDERS table (for an e-commerce site - say eBay or Amazon). In this case, a single order could contain multiple items and different quantities of each item. I thought I could represent this by having a linked list of items in the item column of the ORDERS table and a corresponding linked list for the quantity column.

So when total price of an order has to be established - simply multiply corresponding nodes of th开发者_运维知识库e linked lists and sum them up (of course you have a separate PRICE table that stores price of each item).


Why do you want to use a linked list for this?

Consider the following structure:

Table: ORDERS

  • OrderID
  • client, datestamp, status, ...

Table: ItemsInOrders

  • ID
  • REF_ORDER (FK OrderID)
  • REF_Item (FK ItemID)
  • Quantity

Table: Items

  • ItemID
  • Price
  • Description, image, ...


Konerak gave the proper solution to this problem.

If you need a linked list in a database you basically need a purely object-oriented database or some mixed solution, like object types in Oracle. Then you can implement this yourself on the database side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜