Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Weird DB design question

Hi!

I'm working on a DB for a mini Document Management System. My problem is how to store the different "metadata" sets for the different file types.

Tbl_Object (main table)

Tbl_Article(metadata for an article)

Tbl_Book(metadata for a book)

and so on...

Tbl_Object would be a link to a file, but I have no idea how to do the relations for the case it is a book or an article or sth else?!

Any Ideas??

Thanks heaps!
alexl
[501 byte] By [alexl] at [2007-11-11 10:06:50]
# 1 Re: Weird DB design question
You could do something like this:

tbl_object
----
id
type
location

tbl_article
----
id
object_id (links to tbl_object.id)
<article-specific metadata>

Your other metadata tables would be structured similarly to tbl_article. Or, you could use a single metadata table containing name/value pairs:

tbl_metadata
----
id
object_id
name
value
Phil Weber at 2007-11-11 23:43:27 >
# 2 Re: Weird DB design question
Tbl_Object would be a link to a file, but I have no idea how to do the relations for the case it is a book or an article or sth else?!

store text as html or rtf or image in blob fields for example (depend on DB Server you using), read it with blobstream and handle by coordinate application with OLE. Alternatively store UNC paths to shared network resource and also handle files with appropriate app
Michael Raven at 2007-11-11 23:44:32 >