Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AnotherWannabe
Starting Member
1 Post |
Posted - 2011-08-24 : 18:43:42
|
| Say you wanted a website where a group of people took turns writing short articles (kind of like a blog).(I'm a n00b)I think I only need one database and two tables. One table for keeping the members' info, and another for keeping the article info.Database: dataTable: membersColumns...ID username password fname lname gender birthday state countyemaildatejoinedwatch1watch2watch3watch4watch5watch6watch7watch8watch9watch10Table: articlesColumns...IDauthortitletext_of_articleimagedescriptioncategorydateFirst, is it common for sites to have such a small number of tables and databases, but just keeping them large?Second, you may have noticed the "watch 1" "watch2" etc columns in the member table. My goal is to have a "Watch list" where users can keep track of their 10 favorite articles. I'm not yet at the point in my programming "career" to be able to DO the coding yet. I just want to know if something like this is reasonable for a non-pro to accomplish. I try to imagine how it would work in my mind, but I can't. When someone favorites the article, you would code for it to insert the data in the "watch1" column. That's easy enough. But then how could it know to put the next favorited article in the next column? This is where I begin to doubt if 2 tables is reasonable. Maybe I need a third one just to keep track of this. I'd appreciate the opinions of more experienced folks.Thanks,-Another Wannabe |
|
|
flamblaster
Constraint Violating Yak Guru
384 Posts |
Posted - 2011-08-24 : 23:25:32
|
| I would say that you should probably have a "watch list" table. The fact that you have multiple columns dedicated to various "watches" indicates you probably have the need to have a "one to many" relationship between the members and their watch lists. Having a "watchlist" table would ultimately allow you to be able to dynamically add any number of watch lists. That way, if someone only has 1 that they follow, then you don't have 9 empty fields but if someone wants to watch 20, they still could. |
 |
|
|
|
|
|