DBMSAS2
DBMSAS2
DBMSAS2
1. What is Normalization?
Process of Organizing Data was called Database Normalization
Normalization is used to eliminate undesireble characteristics like Insertion ,
Update and Deletion Anomalies and Minimize the redundancy.
Simply it divides larger tables into smaller and make relationships with other
tables
2. Define 1st Normal Form, 2nd Normal Form and 3rd Normal Form?
1st Normal Form
If we need to turn database into 2nd Normal Form first we must turn database into
1st Normal Form , In this level remove unwanted data that duplicated in table and
create new table and add them into that table.
As a 2nd Normal Form Also first we need to turn database into 2nd Normal Form to
turn database into 3rd Normal Form , In this level we make relationships with
tables that we created in 2nd Normal Form.
4. Identify the Primary key of this relation and justify your selection?
We can create eid column and we can use that column as a Primary Key
In this case all the column data were duplicated so we have to make specific id for
each row we can make column that named eid and set it as primary key and auto
increment because primary key cannot be duplicated
5. Identify Fully Functional Dependencies and Partial Dependencies on the Primary Key?
Fully Functional dependencies :- Employee Name
Partial Dependencies :- Contract No , Employee Name
Company ID, Employee Name
PK(`employee`)->eid PK(`company`)->cid
7. Identify the Transitive Dependencies on above 2nd Normal Form tables
NICN -> Hours
eid
2
3
Company Details
1 IT 001 Kandy
2 IT 120 Colombo
CREATE TABLE `employee` (`eid` INT NOT NULL ,`nicn` VARCHAR(10) NOT
NULL ,`contract_no` VARCHAR(10) NOT NULL ,`hours` INT ,`employee_name
`VARCHAR(45) NOT NULL , );
CREATE TABLE `company` (`cid` INT NOT NULL , `company_id` VARCHAR(10)
NOT NULL , `company_location` VARCHAR(45) NOT NULL,);
INSERT INTO `employee` (`eid` ,`nicn`, `contract_no`, `hours`,` employee_name`) VALUES
(‘1’,’ 892660522V’,’ IT 2014’,’ 27’,’ A.Janith’);
INSERT INTO `employee` (`eid`, `nicn`, `contract_no`, `hours`, `employee_name`) VALUES
(‘2’,’ 880944993V’,’ IT 2014’,’ 84’,’ T.Tharaka’);
INSERT INTO `employee` (`eid` ,`nicn`, `contract_no` ,`hours` ,`employee_name`) VALUES
(‘3’,’ 842564347V’,’ IT 1995,’ 42’,’ C.Asela’);
INSERT INTO `employee` (`eid`,` nicn`, `contract_no`, `hours`, `employee_name`) VALUES
(‘4’,’ 892660522V’,’ IT 1995’,’ 42’,’ A.Janith’);
INSERT INTO `company` (`cid` ,`company_id` ,` company_location `) VALUES (‘1’,’ IT 001’,’
Kandy’);
PK(`employee`)->eid PK(`company`)->cid
There isn’t any query to make relationships in tables after creating many to many relationship
between employee and company table (by graphical method) automatically made table called
employee has company and the foreign keys of that table are employee_eid and company_cid .