3 ms·
> To each their own :) yeah, of course! And if it works, then, by definition, it's good for your customers and thus for you! Also, your approach is probably mo
by jsrn 18y ago
> To each their own :)
yeah, of course! And if it works, then, by definition, it's good for your customers and thus for you! Also, your approach is probably more flexible (no fixed schema for the recursive list structure), which makes it easier and faster for you to iterate and react to customer feedback.
If at some time you want to have a more fixed structure or let the database do some of the server-side validation work of your tree-like structure, here is a good writeup by Phil Greenspun showing how to model and query tree-like datastructures with an RDBMS:
http://philip.greenspun.com/sql/trees.html http://philip.greenspun.com/sql/trees.html
(the rest of the document 'SQL for Web Nerds' is also quite good stuff:
http://philip.greenspun.com/sql http://philip.greenspun.com/sql
)
he uses 'connect by', which is a non-standard Oracle extension, the same thing can be achieved with 'with recursive'-queries, which is standard SQL (1999) and part of PostgreSQL 8.4
Also, Joe Celko's Book 'SQL for Smarties' has a good chapter covering hierarchical data structures in SQL (he also has a separate book about 'trees and hierarchies' in SQL).
Oh, and good luck and much success with your startup!