Click here to Skip to main content
15,890,282 members
Home / Discussions / Database
   

Database

 
GeneralRe: saving/recalling image to/from sql server 2005 using asp.net Pin
roachae29-Jan-09 12:21
roachae29-Jan-09 12:21 
GeneralRe: saving/recalling image to/from sql server 2005 using asp.net Pin
Wendelius29-Jan-09 12:30
mentorWendelius29-Jan-09 12:30 
GeneralRe: saving/recalling image to/from sql server 2005 using asp.net Pin
roachae30-Jan-09 6:19
roachae30-Jan-09 6:19 
GeneralRe: saving/recalling image to/from sql server 2005 using asp.net Pin
Wendelius30-Jan-09 7:40
mentorWendelius30-Jan-09 7:40 
AnswerRe: saving/recalling image to/from sql server 2005 using asp.net Pin
Giorgi Dalakishvili29-Jan-09 18:51
mentorGiorgi Dalakishvili29-Jan-09 18:51 
GeneralRe: saving/recalling image to/from sql server 2005 using asp.net Pin
roachae30-Jan-09 6:23
roachae30-Jan-09 6:23 
QuestionHow would you store the ID of a product? (a little bit long question) Pin
Joan M29-Jan-09 8:13
professionalJoan M29-Jan-09 8:13 
AnswerRe: How would you store the ID of a product? (a little bit long question) Pin
Wendelius29-Jan-09 8:56
mentorWendelius29-Jan-09 8:56 
Just checking that I understood correctly. You have a seller identification (code etc) and the product identification. The product Id is given so it has to be accepted as-is. The products don't have any structure (at least in your system). And the question was partly about duplicates and also about avoiding errors. And the main usage target was in data input. Correct me something was wrong.

I'll just jump to a suggestion (assuming that the previous was correct). Based on the info you provided, I would start with three tables (you didn't mention the database so I'll use SQL Server terminology):

Seller
- Seller# int, identity, primary key, not null 
  (surrogate key)
- Name    varchar, unique key, not null 
  (Seller name if needed)
- Id      int, unique key, not null 
  (Id to show along with the product id)
...

Product
- Product# int, identity, primary key, not null
  (surrogate key)
- Seller#  int, foreign key, unique key (with Id), not null
  (Reference to seller)
- Id       varchar, unique key (with Seller#), not null
  (Id to show along with the seller id)
...


So if you have seller XYZ (with visible Id 05) which has product 123456 and product 98765 you would have records like:
Seller# Name Id
------- ---- --
1       XYZ  05
 
Product# Seller# Id
-------- ------- ---------
1        1       123456
2        1       98765


Optionally if the product Id between sellers is the same, one table could be added so that the seller and the product is stored only once and if you buy the same product from two sellers it would be handled by a link table. It would have only Product# and Seller# and the product table wouldn't vave Seller# anymore.

Also the Id in seller may not be necessary unless for example it is printed to a paper etc. and used visually since those tables don't use the seller id for identification. It's just an optional key element.

Was this answering to your question at all?

The need to optimize rises from a bad design.My articles[^]

GeneralRe: How would you store the ID of a product? (a little bit long question) Pin
Joan M29-Jan-09 21:26
professionalJoan M29-Jan-09 21:26 
GeneralRe: How would you store the ID of a product? (a little bit long question) Pin
Wendelius30-Jan-09 8:31
mentorWendelius30-Jan-09 8:31 
AnswerRe: How would you store the ID of a product? (a little bit long question) Pin
leckey29-Jan-09 9:31
leckey29-Jan-09 9:31 
QuestionAccessing SQL 2005 table through C# Pin
Deepali Khalkar29-Jan-09 2:32
Deepali Khalkar29-Jan-09 2:32 
AnswerRe: Accessing SQL 2005 table through C# Pin
Wendelius29-Jan-09 3:41
mentorWendelius29-Jan-09 3:41 
Questionhow can I get maximum values from set of alphanemeric field [modified] Pin
snehasish29-Jan-09 1:34
snehasish29-Jan-09 1:34 
AnswerRe: how can I get maximum values from set of alphanemeric field Pin
Wendelius29-Jan-09 3:34
mentorWendelius29-Jan-09 3:34 
QuestionTable which will become blank after a certain period. Pin
RajpootRohan29-Jan-09 0:02
professionalRajpootRohan29-Jan-09 0:02 
AnswerRe: Table which will become blank after a certain period. Pin
J4amieC29-Jan-09 0:10
J4amieC29-Jan-09 0:10 
GeneralRe: Table which will become blank after a certain period. Pin
RajpootRohan29-Jan-09 0:28
professionalRajpootRohan29-Jan-09 0:28 
GeneralRe: Table which will become blank after a certain period. Pin
Senthil_M29-Jan-09 19:14
Senthil_M29-Jan-09 19:14 
GeneralRe: Table which will become blank after a certain period. Pin
ashok_rgm30-Jan-09 19:18
ashok_rgm30-Jan-09 19:18 
QuestionMS Access Database Pin
solomondevapaul12328-Jan-09 23:51
solomondevapaul12328-Jan-09 23:51 
AnswerRe: MS Access Database Pin
Wendelius29-Jan-09 4:00
mentorWendelius29-Jan-09 4:00 
GeneralRe: MS Access Database Pin
solomondevapaul12329-Jan-09 19:43
solomondevapaul12329-Jan-09 19:43 
GeneralRe: MS Access Database Pin
Wendelius30-Jan-09 6:39
mentorWendelius30-Jan-09 6:39 
AnswerCross-Post Pin
David Mujica29-Jan-09 4:40
David Mujica29-Jan-09 4:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.