Dear Sir,
I need one Table Design information.
My requirement is:
I have some products (say 10 products) in my master table. Each product has
Product ID (PK).
ID Code Desc
--
1 A1 AAAA
2 B1 BBBBBB
etc. etc...
I have one interface where the user will select the products that he is
interestered with. Mean One user may select product ID 1, 3, 5 and other may
select 2, 7.
I have to save the product info selected by that user in one Column of the
user table.
(I have to save the selected product in one column only)
So What Type will be for that Column and how do i implement logic to save
all selected product so that it will be easy to save and extract the values
also.
I think I can use some binary kind of valu for each product and save the
selected binary combination or similar logic to store and retrieve.
Please suggest.
Thanks
PrabhatPrabhat
Use RDBMS. Split the User table into produtsSeclected and use usertable for
storing base information only. then you will have three tables
Products where product id is primary
users where users id is primary
and Junction Table : Products selected with foreign keys of productid and
userid. thus participating in many to many relationship.
Regards
R.D
"Prabhat" wrote:
> Dear Sir,
> I need one Table Design information.
> My requirement is:
> I have some products (say 10 products) in my master table. Each product ha
s
> Product ID (PK).
> ID Code Desc
> --
> 1 A1 AAAA
> 2 B1 BBBBBB
> etc. etc...
> I have one interface where the user will select the products that he is
> interestered with. Mean One user may select product ID 1, 3, 5 and other m
ay
> select 2, 7.
> I have to save the product info selected by that user in one Column of the
> user table.
> (I have to save the selected product in one column only)
> So What Type will be for that Column and how do i implement logic to save
> all selected product so that it will be easy to save and extract the value
s
> also.
> I think I can use some binary kind of valu for each product and save the
> selected binary combination or similar logic to store and retrieve.
> Please suggest.
> Thanks
> Prabhat
>
>|||However this is the example of bad DB design where you keep multiple
data in single column, you can make that column of varchar type and
build a string of product ID and use comma (,) separator to saperate
each Product ID.
While fetching you ll only need to split IDs from comma|||What is Bad Design ? Normalization or CSVs for OLTP:
IF you forget about Data intigrity and future intigration problems only
then you can use comma seperated values
this sipmle scenario is not possible with csv.
If you want to write a query to select particular product selected by
multiple users,
is it possible when u use CSV.
Regards
R.D
"Zero.NULL" wrote:
> However this is the example of bad DB design where you keep multiple
> data in single column, you can make that column of varchar type and
> build a string of product ID and use comma (,) separator to saperate
> each Product ID.
> While fetching you ll only need to split IDs from comma
>|||Hi R.D.,
You are right. I know the concept and I know we can use 3 tables for that.
But My question was, Is there a better way of calculation / procedure that
we can store all selected value in one column?
Also the Comma separated method is very critical, as if products will
increase we need to increase the width of the field.
Thanks
Prabhat
"R.D" <RD@.discussions.microsoft.com> wrote in message
news:4A593B0A-B72F-4D7F-9FD4-43E851E2C70B@.microsoft.com...
> Prabhat
> Use RDBMS. Split the User table into produtsSeclected and use usertable
for
> storing base information only. then you will have three tables
> Products where product id is primary
> users where users id is primary
> and Junction Table : Products selected with foreign keys of productid and
> userid. thus participating in many to many relationship.
> Regards
> R.D
>
No comments:
Post a Comment