1

In a given table if there is no primary key and even impossible to create a composite primary key then what is the normal form of that table ?

If its zero(0NF) adding a new column and making it primary key will convert this table to 1NF ?

philipxy
  • 14,867
  • 6
  • 39
  • 83
  • Hi. Please give your textbook name & edition. What exactly do you mean there is no PK? What exactly do you mean by [normalization & 0NF & 1NF](https://stackoverflow.com/a/40640962/3404097)?--these have no single meanings. Normalization happens to relations & every one has at least one CK, one of which can be chosen as PK. Why did googling your question/problem not help? – philipxy Jul 15 '18 at 04:45
  • It's just past paper question :) – Keshan akalanka Jul 15 '18 at 05:04
  • And like I said the answers depend on the textbook. – philipxy Jul 15 '18 at 05:13
  • ohh really ! Thanks a lot !! – Keshan akalanka Jul 15 '18 at 08:13

4 Answers4

6

Normal forms apply to relations, which are mathematical structures. Tables can be used to represent relations, but this requires some rules to ensure that the table doesn't contain more or less information than the corresponding relation.

In order for a table to represent a relation:

  • all rows and columns must be unique
  • the order they're in mustn't matter
  • all significant information must be represented as values in cells (i.e. fonts, highlighting, etc, mustn't matter)
  • every cell must contain one value (doesn't matter how simple or complex that value is)

Also, the relational model cares about candidate keys, not primary keys. A relation can have multiple candidate keys. A primary key is just a selected candidate key that is used by some disciplines (e.g. the entity-relationship model) or by some database management systems (e.g. for physical record ordering).

With all that said, I can now answer your question. If your table follows the rules and specifically the rows are all unique, then there will be at least one candidate key, on all the columns together at worst. If your table's rows aren't unique, then the table doesn't represent a relation and the normal forms don't apply. A surrogate key (like an auto-increment column) can be added to identify rows uniquely, but that isn't necessarily sufficient on its own to make a table represent a relation (1NF).

BTW, I suggest you avoid using "0NF" or "UNF". Non-relational tables don't have a level of normalization, so attaching any kind of "NF" to them is misleading.

reaanb
  • 9,806
  • 2
  • 23
  • 37
1

As long as you are talking about tables, there is one further case that needs to be covered. It's the case of duplicate rows.

Duplicate rows are rows that are identical in appearance but not in row number. Such a table cannot have a primary key. Sometimes duplicate rows represent the same information. Sometimes not.

For example, consider a table with just four columns: customerid, productid, quentity, price. If a customer orders the same product twice, we'll have two identical rows, representing different inforation. Ths is not good.

Note that the corresonding thing cannot happen with relations. If two tuples in a relation have the same appearance, then they are the same tuple.

As to the other points, they are covered by excellent earlier answers.

Walter Mitty
  • 18,205
  • 2
  • 28
  • 58
0

before you wan to check for normalization your table must have a Primary key(the primary key is playing lead role in Relational DB,...).

1NF: says that all of your table attributes must be single valued.

Milad Nourizade
  • 461
  • 4
  • 5
  • So if there is no primary key what is the Normal Form of that table ? is it zero ? – Keshan akalanka Jul 15 '18 at 05:04
  • yes it is, the zero one is the completely unnormalized structure. – Milad Nourizade Jul 15 '18 at 05:31
  • 2
    @Nipunachandimal: if the table is *not* in 1NF - then it's just in **no** NF - there's no "numerical" NF level for that. Either it *is* in 1NF - or not. – marc_s Jul 15 '18 at 07:25
  • 1
    @Nipunachandimal & Miladnourizade Follow the links in my comment on the question & you will see that the original 1NF meant a relation with no relation-valued attributes. These terms 0NF-UNF-1NF do not have fixed meanings, and many of the "meanings" are fuzzy. One thing is for sure, if it is a relation then it has a CK/PK, and if it doesn't have a CK/PK then it isn't a relation. And if it isn't a relation it doesn't make sense to talk about it having or not having a CK/PK. Note that some texts do say certain non-relational things are in 0NF or UNF; others use those terms for certain relations. – philipxy Jul 15 '18 at 08:36
  • @marc_s Re "1NF" see my last comment on this answer. – philipxy Jul 15 '18 at 08:42
0

Answer of Question 1 : In a given table if there is no primary key and even impossible to create a composite primary key then what is the normal form of that table ?

Answer : If it is no primary key in relation and if it is impossible to create a composite primiary key(According to me your question says ,even if combine all the column of row to make candidate key then also it will not able to identify your relationship uniquly(duplicate rows are there), hence it is not in any normal form.

Answer of Question 2: If you add some column(having unique values in it) and if all the cell contains only one value then it is in 1NF.

Still if you need some clarification can ask in comment box. 0NF is not any form of normalization. refer C.J. Date or Henry korth(database management system book) Hope this helps.

Suman Tiwari
  • 40
  • 1
  • 10