Search code examples
mysqlvb.netnormalizationdatabase-normalization

Normalization of Table


I am trying to create a simple Registration Program using VB.Net and MySQL for its database. Here's my simple table for the basic Information

enter image description here

However, I am attempting to improve my basic knowledge in normalization of table and that's why I separated the Date field to avoid, let say in one day, the repeated insertion of the same date. I mean, when 50 individuals registered in one day, it will simply add a single date(record) in tblRegDate table instead of adding it up for 50 times in a table. Is there any way to do this? Is it possible in VB.Net and MySQL? Or rather, should I add or modify some field? or should I make a condition in VB.Net? The table above is what my friend taught me but I discovered that it doesn't eliminate the redundancy. Kindly give me any instruction or direct me to site where there's a simple tutorial for this. Thanks in advance!

here's my MySQL codes:

CREATE TABLE tblInfo(
       Number INT AUTO_INCREMENT,
       LastName VARCHAR(45),
       FirstName VARCHAR(45),
       MiddleName VARCHAR(45),
       Gender ENUM(M,F),
       BirthDate DATE,
       PRIMARY KEY(Number));

CREATE TABLE tblRegDate(
       IDRegDate INT AUTO_INCREMENT,
       Date TIMESTAMP,
       Number INT,
       PRIMARY KEY(IDRegDate),
       FOREIGN KEY(Number) REFERENCES tblInfo(Number));

Solution

  • As I see it in this case you don't have advanages of seperating a single field. You'll loose a lot of performance.

    Table normalization isn't about don't having any redundant value. It's more about "Seperating the concerns"

    Also it is important to not have an exploding complexity in your database. seperating single fills would end up in a database no one would be able to understand.

    The Question is: Are there more informations on registration ? For Example Webpage, IP, .....

    Than you should have two tables for example "Person" and "Registration". Then you would have two semantic different things which shouldn't be mixed up.

    There are a lot of examples and information you can find via google. and wikipedia http://en.wikipedia.org/wiki/Database_normalization