Joe,

It's possible to create a table for each image.  However, as others have
suggested, in most cases, it makes more sense to have an images table, with
all the images, and with a unique image ID for each image (you can create
your own or use autoincrement).  You can then have tables like reviews,
comments and ratings, which all refer to the images table using an image ID
field.

This means you don't have to do a "create table" each time there is a new
image, but, really, the key advantage to doing this is that it's easy to do
queries to locate ...
- all the images that match certain criteria
- all the reviews for one image 
- all ratings made by one user
- the 100 top-rated images
and so on.  What it really does is enables you to use SQL to locate and
select data in the database, rather than having to write code to locate and
loop through tables to find what you are looking for.


Tom Haapanen
[EMAIL PROTECTED]


-----Original Message-----
From: Joe [mailto:[EMAIL PROTECTED]]
Sent: 22 October 2001 02:04 
To: [EMAIL PROTECTED]
Subject: Database Structures

Hello,

Hi, I need some help on something here. I need to know the best way to set 
up this database.

I have a site with a bunch of images/reviews. What i want is for registered 
users to rate and leave reviews themselves. I'm not sure how I should set 
up this database though.

Now, I have a table that holds the user info. Should I create a new table 
for each image, which holds the user, and his comments/rating? (this seems 
rather bloated, and inefficient) or should I create a table somehow for all 
images and keep track of the user comments/ratings another way?

Thanks. I've been looking for sites about database structuring and stuff, 
but no good luck. If anyone could give me sites or their ideas it would be 
appreciated


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to