Soroush Taheri
Soroush Taheri

Reputation: 5

Holding multiple data in a column

I'm already working on a warehouse management software. Once we needed a purchase requests section in the software, a question raised in my mind. Obviously, there could be "multiple" items to be requested by a person and I don't understand how to hold these multiple informations of requested stuff (such as stuff ID, the number of stuff or total price...) in a single table and in a single column. (Maybe you can call it "requested stuff")

Naturally (as my knowledge tells me) you can't hold multiple data in a single column.

Upvotes: 0

Views: 58

Answers (3)

Walter Mitty
Walter Mitty

Reputation: 18940

This is a basic exercise in data normalization, specifically first normal form. In order to keep different items of "requested stuff" separate, so that you can work with them, you need to put them on different rows of a table.

So you need one table for requests, and another table for request details. Each row in request details pertains to one item within a request. The key to request details will be composite, made up of the key to requests plus an item number to make it unique.

Upvotes: 0

vjy tiwari
vjy tiwari

Reputation: 861

You can store the set of product details in a single column in serialize format.

Upvotes: 0

Bartosz Bilicki
Bartosz Bilicki

Reputation: 13235

What you are looking for is one-to-many relational model. One person may have many 'requested stuff'. Look for 'One-to-many relationship' in google or in any data-modeling book. Other terms to check: database normalization and normal form.

PS. It looks to me you will need yet more level of indirection. One person may have multiple orders, and each order may have multiple items.

Upvotes: 1

Related Questions