CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
SQL Database Question

 



Hawk
stranger

Jan 1, 2001, 2:37 PM

Post #1 of 4 (318 views)
SQL Database Question Can't Post

Hello,

Im working on a little project that will allow users to rate software
and leave comments on it (comments are NOT pre-defined). I expect some software to get hundreds, if not
thousands of comments left. What would be the most efficient way to store
and retrieve this data? e.g. Would it be wasteful to have each entry get its
own line such as

software1 comment1
software2 comment1
software3 comment1
software2 comment2
software1 comment2
software2 comment3

OR, is there a way insert the comment into its respective products line such
as

software1 comment1
comment2
comment3
software2 comment1
comment2

If the second method is acceptable (it seems much more efficient) how would I
do it? How would I retrieve the comments for each software product?

Thanks in advance!



Dubbs1231
newbie

Jan 1, 2001, 9:14 PM

Post #2 of 4 (315 views)
Re: SQL Database Question [In reply to] Can't Post

I would probably go with the first method, since the only way i can think of making the second work would be to make a separate table in your SQL db for each piece of software. This seems very inefficient, so I would go with the first.

First method:
table: software
cols: softwareid, comment (each comment in a separate row with it's corresponding softwareid)

Second Method:
table: software1
cols: comment (each comment for software1 alone in a separate row in this table)

table: software2
cols: comment (each comment for software2 alone in a separate row in this table)

and so forth


Hope this helps but since i'm a newbie to MySQL, my suggestion may not be the best.

God Bless,

Erich Musick



(This post was edited by Dubbs1231 on Jan 1, 2001, 8:18 PM)


egorFiNE
Deleted

Jan 3, 2001, 8:59 AM

Post #3 of 4 (302 views)
Re: SQL Database Question [In reply to] Can't Post

The better way is to manage two tables: software and coments.

Software: softid, softname
Comments: commentid, softid, comment

then you can do something like that:

select comment from comments
where comments.softid=$softid

// Egor Egorov, perl4YOU software development company
// http://www.perl4you.com




Cure
User

Jan 15, 2001, 10:05 AM

Post #4 of 4 (288 views)
Re: SQL Database Question [In reply to] Can't Post

www.sqlcourse.com


Cure


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives