Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2016 January Database Design: Storing a comma separated list in a Database, Is a Bad Practice?

Database Design: Storing a comma separated list in a Database, Is a Bad Practice?

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

Should we store comma – separated list in a database?
My suggestion and answer are: Never store comma – separated or delimited list in a Database.

I found this discussion in many forums and blogs so, in this post, I would like to share my opinions and views on this topic.

Why we should not store comma – separated or delimited list?

We cannot enforce uniqueness inside the list, e.g. list can be like this: 5, 4, 8, 8, 8, 6.

We cannot ensure right data-type for all the values, e.g. list can be like this: 5, 8, 7, temp, abc, $, 8.

Do not possible to check referential integrity.

It is tough to search any data or value from the list and sometimes we have to use regular expressions to search the string.

We cannot perform any DML operation on a single value from the list without fetching the whole list.

Getting all the records in sorted order is tough.

Counting elements from the list is terrible.

When we are storing integer data into the list, it takes twice the space than binary integers.

We cannot use list value in the join conditions.

When we store the comma separated value, the overall maintenance of this list and data is complicated.

The simplest solution of this problem, is to create a separate table, or you can use data type like XML, JSON.

Jan 28, 2016Anvesh Patel
SQL Server 2012: Error Msg 3729 Cannot DROP SEQUENCE because it is being referenced by ObjectMySQL: FEDERATED Table Engine - SELECT data from another Server (Part 1/4)
Comments: 1
  1. Smithd934
    October 5, 2018 at 2:19 am

    This is really attention-grabbing, You’re a very professional blogger. I have joined your rss feed and sit up for in search of extra of your fantastic post. Also, I have shared your site in my social networks!

Anvesh Patel
Anvesh Patel

Database Engineer

January 28, 2016 Database DesigningAnvesh Patel, comma separated, database, database concept, database research and development, database standards, Database Theory, database topic, dbrnd, delimited list, RDBMS
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....