views:

47

answers:

5

Suppose I have a set of data, given the data and the relation schemas can I assume that the set of data is normalized in one form or the other. In my opinion raw data given, has to be normalized into some form. However a discussion with a friend has led to ask me this question here.

To expound more on the question, I would say given a set of functional dependencies for a relation or table, is it guaranteed that the table would atleast be in 1NF if not others

+1  A: 

No, The raw data are not necessarily normalized in 1NF. It depends on the schemas. There can be schema design which is not even in 1NF.

Let me give you an example, Suppose there is a table which stores marks of all semester student. Each semester is having studentid 5. Assume the schema for Marks as

Marks(studentid,marks)

This table is not in 1NF as it will have repeated values.

Himadri
+2  A: 

In my experience, in real life, you'll run into databases that span the entire spectrum from perfectly normalised to a complete mishmash of wierd stuff that you'd never expect to see anywhere, let alone in a database.

You certainly can't expect to find data in even 1NF (which is supposedly the most "basic" normalisation form).

Also, that's not to say that normalised data should be the "goal" of database design. You need to weigh clean design against performance criteria and fully normalised database can often work against your performance criteria.

Dean Harding
A: 

The SQL model permits tables that are not true relations at all (tables with duplicate rows for example). So it certainly is not the case that SQL databases are always normalized. I expect most people who work with databases have come across examples of tables without keys.

dportas