Tech Support > Microsoft Windows > Development Resources > What file structure for this type of data ?
What file structure for this type of data ?
Posted by cnlai on March 16th, 2007


Assume I have the following data:

Product, Category (assume all numerals)


I need to perform the following queries at various times:
1. For a given product, what categories does it belong to (more than 1
category possible) ?
2. For a given category, what products are available ?

Questions
1. Without using a database, what file structure is suitable ? (If a B+ tree
is used, 2 files are needed: one to collect all products belonging to a
category, one to collect all categories for a product.)

2. In a database, what file structure is used for processing the above
queries ?


Posted by Mike Wahler on March 17th, 2007



"cnlai" <cnlai@pc.jaring.my> wrote in message
news:etdnbj$1frh$1@news9.jaring.my...
If you're using an index (e.g. a B+ tree), I would call that a 'database'.
With no database (for my conception of 'database'), the only alternative
is a 'flat file', which would necessarily have redundancy (all possible
combinations stored), e.g.:

Product Category
1 1
1 2
1 3
2 1
2 2
3 3

If you have a reasonably small data set, this might be the way to go,
since it would keep the code simple and very maintainable.

It would typically use one or more indices, which might be separate files,
or indices and data could be embedded in a single file. Each method has
its advantages and disadvantages.

Another possiblity is to use an already made database package, such as
Oracle or SQL. You'd need to study up on their programmatic interfaces,
and make sure one is offered in a language you're familiar enough with.

Finally, what has this to do with Win32 programming?
You'll probably get more (and better) advice from newsgroups
about databases and algorithms, where people well-versed in
those discipline are more likely to congregate.

-Mike




Similar Posts