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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
SQL Database Question



Jan 1, 2001, 2:37 PM

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


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

software1 comment1
software2 comment1

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!


Jan 1, 2001, 9:14 PM

Post #2 of 4 (330 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)


Jan 3, 2001, 8:59 AM

Post #3 of 4 (317 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


Jan 15, 2001, 10:05 AM

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



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

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