How can I use Improve Table structure feature? ΒΆ
Improve table structure feature helps to bring the table structure upto Third Normal Form. A wizard is presented to user which asks questions about the elements during the various steps for normalization and a new structure is proposed accordingly to bring the table into the First/Second/Third Normal form. On startup of the wizard, user gets to select upto what normal form they want to normalize the table structure.
Here is an example table which you can use to test all of the three First, Second and Third Normal Form.
CREATE TABLE `VetOffice` ( `petName` varchar(64) NOT NULL, `petBreed` varchar(64) NOT NULL, `petType` varchar(64) NOT NULL, `petDOB` date NOT NULL, `ownerLastName` varchar(64) NOT NULL, `ownerFirstName` varchar(64) NOT NULL, `ownerPhone1` int(12) NOT NULL, `ownerPhone2` int(12) NOT NULL, `ownerEmail` varchar(64) NOT NULL, );
The above table is not in First normal Form as no primary key exists. Primary key is supposed to be (petName,`ownerLastName`,`ownerFirstName`) . If the primary key is chosen as suggested the resultant table won't be in Second as well as Third Normal form as the following dependencies exists.
(OwnerLastName, OwnerFirstName) -> OwnerEmail (OwnerLastName, OwnerFirstName) -> OwnerPhone PetBreed -> PetType
Which says, OwnerEmail depends on OwnerLastName and OwnerFirstName. OwnerPhone depends on OwnerLastName and OwnerFirstName. PetType depends on PetBreed.