Re: How to 'normalise' this scenario

From: Frank Millman <frank_at_chagford.com>
Date: Tue, 17 May 2011 04:16:27 -0700 (PDT)
Message-ID: <e08da387-69e7-4afa-82ac-60b7c4429ab5_at_p23g2000vbl.googlegroups.com>


On May 17, 12:08 pm, Erwin <e.sm..._at_myonline.be> wrote:
> On 16 mei, 08:50, Frank Millman <fr..._at_chagford.com> wrote:

Hi Erwin

Thanks for your comments - you have got me thinking.

I have stripped most of the comments, because what I have left is the crux of the matter.

> You have not stated what "the requirement" is.

Let's take an example we should all be familiar with - a file system.

Assume that we have a lot of files, and we have a table where each row represents one file, with columns such as file name, disk address, date created, date last modified, etc.

You can sort the table by name, creation date, etc. However, it is getting difficult to manage, so a bright spark comes up with the idea of directories/folders.

The user can create directories on demand, place directories within directories, assign files to directories, move files between directories, etc.

The requirement is to create a database structure to represent the directories.

My guess is that you could use an adjacency list or a nested set for this purpose. However, where I am getting stuck is, how does one link an entry in the 'files' table to an entry in the 'directories' table, to indicate that a particular file resides in a particular directory.

I have been trying to create an entry in the 'directories' table that represents, or points to, a 'file'. From your comments, it would appear that this is the wrong approach.

I could carry on and speculate further, but I think this is a good time to pause and ask if this is a good example, and ask if there is a preferred solution.

TIA Frank Received on Tue May 17 2011 - 13:16:27 CEST

Original text of this message