Online Shopping : Computers : Databases

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 5 people (80%) answered Yes
Recently 4 of 5 people (80%) answered Yes

Entry

Database: Data: Principle: Concatenation: Should you concatenate your data stored in database?

May 2nd, 2008 21:02
dman, Knud van Eeden, http://sturly.com


----------------------------------------------------------------------
--- Knud van Eeden --- 01 November 2004 - 12:57 am -------------------
Database: Data: Principle: Concatenation: Should you concatenate your 
data stored in database?
---
In general you should store your data as little concatenated
as possible (so each possible data 'atom' in its own column).
---
This because you can better combine the data 'atoms' in this columns 
to a
larger whole (if you concatenate, you have to possibly separate again
later, which might lead to extra overhead (e.g. you need to insert some
extra separators (e.g. a '-' sign) to show what the individual parts
are)).
Also doing an SQL query might be easier to do when the data is split in
different columns.
---
---
E.g.
So in a column you store first name and last name each in a separate
column
------------------------
column 1      column 2
------------------------
John          Doe
Vanessa       Belle
John          von Halen
------------------------
and so not together in 1 column, e.g.
------------------------
column 1
------------------------
John Doe
Vanessa Belle
John von Halen
------------------------
as it might sometimes not be clear what belongs to what.
(e.g. belongs 'von' to the first name or to the last name?),
and you als might need to separate this information in your
program, which might be extra overhead.
----------------------------------------------------------------------