Modeling Data Objects
Modeling Data Objects
Use the analysis to make operating decisions and to improve the process.
1.1.1 Identify Entity types entity sets, attributes and keys
What is entity in a database?
An Entity is an object with a physical existence or a conceptual existence.
- It can be roles, events, locations, tangible things or concepts.
In database terms, an entity is a table which is responsible for storing data in the database.
Entity type is the set of all possible values for an entity.
- An entity set is a set of entities of the same type (collection of instances represented by (e1, e2, e3, ... en).
- It is also called an extension of the entity type
Entity Instance is a single occurrence of a particular entity type.
Entity type name EMPLOYEE PROJECT
Attributes name Name, Age, salary Pname, Pcode, Location
e1 P1
(Abebe, 25, 3500) (Database, p001, Bahir Dar) One entity instance
e2 P2
Entity set (Daniel, 42, 2500) (Water, P002, Gonder) One entity instance
(Extension) e3 P3
(Aster, 32, 3000) (Construction, P003, Gonder)
. . One entity instance
. .
*
en pn
**
In E-R Diagram, an entity type is represented by a rectangle, and the name is indicated in capital letters.
Example:
DEPARTMENT EMPLOYEE
Attributes
- An attribute is a property that describes an entity.
- Each attributes has a particular value based on the defined data type.
- The set of all possible (allowable) values of an attribute is called attribute domain.
- In E-R Diagram, attributes are named with an initial capital letter followed by lowercase letters.
- An attribute can be represented by an ellipse (oval) shape with a line connected it to the associated entity.
Example:
- It can also be represented by listing them within the entity rectangle, under the entity name(entity type).
Example: EMPLOYEE
Emp_Id
Fname
lname
Types of attributes
An attribute can be: - simple or composite, single-value or multi-value, stored or derived
or Null Values.
1) Simple (Atomic) vs Composite attribute
. Simple attributes cannot be further divisible.
Example: SSN, Sex
. In E-R Diagram, simple attributes can be represented by an ellipse shape. Example:
• A backup server responsible for backing up and restoring files, folders, databases on a network in order to
prevent the loss of data in the event of a hard drive failure, user error, disaster or accident.
• A DHCP Server is used to assigns IP addresses to client computers automatically. All IP addresses of all
computers are stored in a database that resides on a server machine.
• DNS Server is needed for resolving hostnames to their IP addresses.
1.2.2 Operating systems
An operating system (OS) is a collection of software that enables the computer hardware to communicate and
operate with the computer software.
The operating system is a vital component of the system software in a computer system. Without operating system,
a computer would be useless. Application programs require an operating system to function.
1.2.3 Gateways
A network gateway is an internetworking system capable of joining together two networks that use different base
protocols. A network gateway can be implemented completely in software, completely in hardware, or as a
combination of both.
A Gateway is - used between two dissimilar LAN s.
- required to convert Data packets from one protocol format to another Protocol format.
Router and Gateway both are sometimes used interchangeably but the difference is that Gateway operates on 7th
layer of the OSI Model and the Router works on the 3rd layer of the OSI model.
The OSI Layer consists of:
1. Physical layer
2. Data Link
3. Network,(performs establishment of connection between networks and the Routing and selecting best path)
4. Transport layer
5. Session layer
6. Presentation layer
7. Application Layer. (Provides semantic exchange of data between application in an open system)
1.2.4 Application service provider
An application service provider (ASP) is a business that provides computer-based services to customers over a
network. I.e.: Application service provider is remote software that you access through a web browser.
The goal of an application service provider is to reduce the cost of software distribution and maintenance.
1.2.5 ISP
An Internet service provider (ISP) is an organization/company that provides internet access to users or
subscribers of its service, usually for a fee.
1.3. Reviewing business rules to determine impact
A business rule is a rule of a business, company, or corporation that defines/determine or constrains some aspect
of business and always resolves to either true or false.
1.3.1. Overview of business rules
Business rules describe the business polices that apply to the data stored on a company’s databases.
Business-rules constraints fall into two categories: field constraints within tables, and relationship constraints
between tables.
1.4. Relationships
A relationship is an association that exist b/n two or more participating entities.
- In E-R Diagram, a relationship type is represented by a diamond shape
with the relationship verb in it.
A functional dependency (FD) is a constraint between two sets of attributes in a table from a table in the
database.
* A functional dependency occurs when one attribute in a table uniquely determines another attribute. This
can be written as: A B ("B is functionally dependent upon A").
If a particular value of one attribute (A) in a table uniquely determines the value of another attribute (B) in the
same table, then there is a functional dependency between attributes A and B.
Examples: In a table employee’s characteristic including employee ID and name, it can be said that name is
functionally dependent upon ID because an employee's name can be uniquely determined from their ID. However,
the reverse statement is not true because more than one employee can have the same name but different ID.
Full functional dependency
A full functional dependency occurs when you already meet the requirements for a functional dependency and
the set of attributes on the left side of the functional dependency statement cannot be reduced any farther.
Example: {SSN, age} name is a functional dependency, but it is not a full functional dependency because you
can remove age from the left side of the statement without impacting the dependency relationship.
Transitive dependency.
Transitivity dependency is a functional dependency between non-primary-key.
I.e.: It occurs when there is an indirect relationship that causes a functional dependency.
Example: AC is a transitive dependency when “A B” and “B C” are true.
2.4. Normal forms based on primary keys
first Normal Form (1NF):
Relation R is in first normal form (1NF) if:
- Domain of an attribute must contain only atomic values (Value of any attribute must be a single value from
the domain).
- There are no duplicated rows in the table.
- Entries in a column (attribute, field) are of the same kind.
DEPARTMENT
Dname Dnumber Dmgr_ID Dlocations
Remove the “Dlocations” field from the department table to disallow multiple for a single instance/occurrence.
DEPARTMENT
Dname Dnumber Dmgr_ID
DEPARTMENT_LOCATION
Dnumber Dlocation
Now both above tables are 1NF.
2nd Normal Form (2NF):
A relation R is in 2NF if: - it is in 1NF
- Every non-primary key attribute A in R is fully functionally dependent on the primary key of R(has no
partial dependencies).
- If you know value of primary key, all other attributes are determined
EMPLOYEE_PROJECT
ID Pnumber Hours Ename Pname Plocation
Functional dependencies:
{ID, Pnumber} --> {Hours}
{ID} --> {Ename} This is not in 2NF.
{Pnumber} --> {Pname, Plocation}
2NF normalization:
EP1
ID Pnumber Hours
{ID, Pnumber} --> {Hours}
EP2
ID Ename
{ID} --> {Ename}
EP3
Pnumber Pname Plocation
{Pnumber} --> {Pname, Plocation}
Now all above tables are in 2NF.
3rd Normal Form (3NF):
A relation R is in 3NF if:
It is in 2NF.
Relation R should not have a non-key attribute functionally determined by another non-key attribute
(no transitive dependencies).
EMPLOYEE_DEPARTMENT
Ename ID Bdate Address Dnumber Dname Dmgr_ID
Functional dependencies:
{ID} --> {Ename, Bdate, Address, Dnumber, Dname, Dmgr_ID}
{Dnumber} --> {Dname, Dmgr_ssn} This is not in 3NF.
3NF normalization:
ED1
Ename ID Bdate Address Dnumber
{ID} --> {Ename, Bdate, Address, Dnumber}
ED2
Dnumber Dname Dmgr_ID
{Dnumber} --> {Dname, Dmgr_ID}