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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Quick Question on merging two Tables

Author  Topic 

Insane in the Membrane
Starting Member

1 Post

Posted - 2008-09-17 : 18:06:51
Hi there,

I have a basic database architecture question that I hope to consult everyone here on.

Let's say I have an SQL table for polling/voting data (2 options ):

Vote:
vote_id(PRIMARY)
vote_topic(VARCHAR)
vote_option1(INT)
vote_option2(INT)


However, later on, if there are more options of voting data such there there can be more vote_option fields, the current table wouldn't suffice.

Therefore, is it a good idea to restructure the Vote table to such :

Vote:
vote_id(PRIMARY)
vote_topic(VARCHAR)
vote_option_no(INT)
vote_option_data(VARCHAR)


In this case, the vote_option_no field will keep track of the number of voting options, and vote_option_data will be a string containing all the vote_option data separated by , e.g. a delimiter like the | character( 2|34|5|3 ) ?


Is this the right way to solve such a problem ?

Thanks!
IZ

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-18 : 00:40:46
Nope. this is against first normal form. I think its better to keep a seperate table for votingoptions. the staructure will be like

votingoptionid
votingid(fk to voting table)
votingoptiondata

add a record to this table for each voting option added for a particular vote and link it by means of votingid
Go to Top of Page
   

- Advertisement -