dbTalk Databases Forums  

Single or Multiple Tables?

comp.databases comp.databases


Discuss Single or Multiple Tables? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ian Oxley
 
Posts: n/a

Default Single or Multiple Tables? - 08-12-2008 , 02:46 AM






Hi

I was wondering which of the design approaches below would be better:

Within the admin section of a website administrators can upload
Resources for inclusion throughout the site. Now, these Resources can
be either images, videos or documents e.g. PDF's, etc.

Which of the following solutions would be best?

1. Creating a single table named Resources into which all resources
would be inserted, then having some way of differentiating between the
different types of resources e.g. a 'resource_type' column; or

2. Creating separate tables for each type of resource e.g. Images,
Videos, Documents and inserting each resource into the appropriate
table.

Any help would be greatly appreciated.

Thanks

Reply With Quote
  #2  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-12-2008 , 07:03 AM






On Aug 12, 3:46 am, Ian Oxley <ijox... (AT) googlemail (DOT) com> wrote:
Quote:
Hi

I was wondering which of the design approaches below would be better:

Within the admin section of a website administrators can upload
Resources for inclusion throughout the site. Now, these Resources can
be either images, videos or documents e.g. PDF's, etc.

Which of the following solutions would be best?

1. Creating a single table named Resources into which all resources
would be inserted, then having some way of differentiating between the
different types of resources e.g. a 'resource_type' column; or

2. Creating separate tables for each type of resource e.g. Images,
Videos, Documents and inserting each resource into the appropriate
table.

Any help would be greatly appreciated.

Thanks
From the information you gave, there is no clear answer.

A DATABASE is a model of the external world. So the question is: what
are you modeling?

One way to get at the answer is to ask how you would query the
database. Does you plan to search for resources or would you be
searching for images, documents, etc. What would your WHERE clause
look like? You gave no other attributes for these "resources".

Or are you just using the database as an expensive file system?

Ed


Reply With Quote
  #3  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-12-2008 , 07:03 AM



On Aug 12, 3:46 am, Ian Oxley <ijox... (AT) googlemail (DOT) com> wrote:
Quote:
Hi

I was wondering which of the design approaches below would be better:

Within the admin section of a website administrators can upload
Resources for inclusion throughout the site. Now, these Resources can
be either images, videos or documents e.g. PDF's, etc.

Which of the following solutions would be best?

1. Creating a single table named Resources into which all resources
would be inserted, then having some way of differentiating between the
different types of resources e.g. a 'resource_type' column; or

2. Creating separate tables for each type of resource e.g. Images,
Videos, Documents and inserting each resource into the appropriate
table.

Any help would be greatly appreciated.

Thanks
From the information you gave, there is no clear answer.

A DATABASE is a model of the external world. So the question is: what
are you modeling?

One way to get at the answer is to ask how you would query the
database. Does you plan to search for resources or would you be
searching for images, documents, etc. What would your WHERE clause
look like? You gave no other attributes for these "resources".

Or are you just using the database as an expensive file system?

Ed


Reply With Quote
  #4  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-12-2008 , 07:03 AM



On Aug 12, 3:46 am, Ian Oxley <ijox... (AT) googlemail (DOT) com> wrote:
Quote:
Hi

I was wondering which of the design approaches below would be better:

Within the admin section of a website administrators can upload
Resources for inclusion throughout the site. Now, these Resources can
be either images, videos or documents e.g. PDF's, etc.

Which of the following solutions would be best?

1. Creating a single table named Resources into which all resources
would be inserted, then having some way of differentiating between the
different types of resources e.g. a 'resource_type' column; or

2. Creating separate tables for each type of resource e.g. Images,
Videos, Documents and inserting each resource into the appropriate
table.

Any help would be greatly appreciated.

Thanks
From the information you gave, there is no clear answer.

A DATABASE is a model of the external world. So the question is: what
are you modeling?

One way to get at the answer is to ask how you would query the
database. Does you plan to search for resources or would you be
searching for images, documents, etc. What would your WHERE clause
look like? You gave no other attributes for these "resources".

Or are you just using the database as an expensive file system?

Ed


Reply With Quote
  #5  
Old   
Robert Klemme
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-12-2008 , 11:46 AM



On 12.08.2008 14:03, Ed Prochak wrote:
Quote:
On Aug 12, 3:46 am, Ian Oxley <ijox... (AT) googlemail (DOT) com> wrote:

Within the admin section of a website administrators can upload
Resources for inclusion throughout the site. Now, these Resources can
be either images, videos or documents e.g. PDF's, etc.

Which of the following solutions would be best?

1. Creating a single table named Resources into which all resources
would be inserted, then having some way of differentiating between the
different types of resources e.g. a 'resource_type' column; or

2. Creating separate tables for each type of resource e.g. Images,
Videos, Documents and inserting each resource into the appropriate
table.

From the information you gave, there is no clear answer.
That's true. It sounds as if all these "resources" are treated
uniformly. In that case I'd probably have a single table with a BLOB
for the data and a column for storing the MIME type - along with other
information necessary to identify resources.

Quote:
Or are you just using the database as an expensive file system?
Expensive but transaction safe and fully integrated in backup etc.!

Kind regards

robert


Reply With Quote
  #6  
Old   
Robert Klemme
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-12-2008 , 11:46 AM



On 12.08.2008 14:03, Ed Prochak wrote:
Quote:
On Aug 12, 3:46 am, Ian Oxley <ijox... (AT) googlemail (DOT) com> wrote:

Within the admin section of a website administrators can upload
Resources for inclusion throughout the site. Now, these Resources can
be either images, videos or documents e.g. PDF's, etc.

Which of the following solutions would be best?

1. Creating a single table named Resources into which all resources
would be inserted, then having some way of differentiating between the
different types of resources e.g. a 'resource_type' column; or

2. Creating separate tables for each type of resource e.g. Images,
Videos, Documents and inserting each resource into the appropriate
table.

From the information you gave, there is no clear answer.
That's true. It sounds as if all these "resources" are treated
uniformly. In that case I'd probably have a single table with a BLOB
for the data and a column for storing the MIME type - along with other
information necessary to identify resources.

Quote:
Or are you just using the database as an expensive file system?
Expensive but transaction safe and fully integrated in backup etc.!

Kind regards

robert


Reply With Quote
  #7  
Old   
Robert Klemme
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-12-2008 , 11:46 AM



On 12.08.2008 14:03, Ed Prochak wrote:
Quote:
On Aug 12, 3:46 am, Ian Oxley <ijox... (AT) googlemail (DOT) com> wrote:

Within the admin section of a website administrators can upload
Resources for inclusion throughout the site. Now, these Resources can
be either images, videos or documents e.g. PDF's, etc.

Which of the following solutions would be best?

1. Creating a single table named Resources into which all resources
would be inserted, then having some way of differentiating between the
different types of resources e.g. a 'resource_type' column; or

2. Creating separate tables for each type of resource e.g. Images,
Videos, Documents and inserting each resource into the appropriate
table.

From the information you gave, there is no clear answer.
That's true. It sounds as if all these "resources" are treated
uniformly. In that case I'd probably have a single table with a BLOB
for the data and a column for storing the MIME type - along with other
information necessary to identify resources.

Quote:
Or are you just using the database as an expensive file system?
Expensive but transaction safe and fully integrated in backup etc.!

Kind regards

robert


Reply With Quote
  #8  
Old   
--CELKO--
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-13-2008 , 09:46 AM



From the spec you gave, I would tend to a single table for Resources
qua Resources with dates, sources, descriptions, media type, etc, that
includes a column for the names of the files that contain the actual
images, videos or documents. Then lock or encrypt the files so that
only the Admin can get to them to prevent tampering.

I never liked putting BLOB style data into SQL. It gets too
proprietary, you cannot query it anyway and next week someone invents
a new spiffy media that you cannot handle properly.


Reply With Quote
  #9  
Old   
--CELKO--
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-13-2008 , 09:46 AM



From the spec you gave, I would tend to a single table for Resources
qua Resources with dates, sources, descriptions, media type, etc, that
includes a column for the names of the files that contain the actual
images, videos or documents. Then lock or encrypt the files so that
only the Admin can get to them to prevent tampering.

I never liked putting BLOB style data into SQL. It gets too
proprietary, you cannot query it anyway and next week someone invents
a new spiffy media that you cannot handle properly.


Reply With Quote
  #10  
Old   
--CELKO--
 
Posts: n/a

Default Re: Single or Multiple Tables? - 08-13-2008 , 09:46 AM



From the spec you gave, I would tend to a single table for Resources
qua Resources with dates, sources, descriptions, media type, etc, that
includes a column for the names of the files that contain the actual
images, videos or documents. Then lock or encrypt the files so that
only the Admin can get to them to prevent tampering.

I never liked putting BLOB style data into SQL. It gets too
proprietary, you cannot query it anyway and next week someone invents
a new spiffy media that you cannot handle properly.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.