Vous êtes sur la page 1sur 4

HAMDARD UNIVERSITY MAIN CAMPUS

FUNDAMENTAL OF INFORMATION SYSTEM

INTEGRITY RULES
Entity Integrity:
All primary key entries are unique and no part of a primary key may be null. This guarantees that each entity will have a unique identify and ensures that foreign key values can properly reference primary key values. For example no invoice can have a duplicate number nor can it be null in short all invoices are uniquely identified by their invoice number.

Referential Integrity:
A foreign key may have either a null entry as long as it is not a part of its tables primary key or an entry that matches the primary key value in a table to which it is related. Every non-null foreign key value must reference as existing primary key. This makes it possible for an attribute not to have a corresponding value, but it will be impossible to have an invalid entry. The enforcement of the referential integrity rule makes it possible to delete a row in one table whose primary key has mandatory matches foreign key values in another table. For example a customer might not yet have an assigned sales representative number, but it will be impossible to have an invalid sales representative number.

E-R Diagram: One to Many:


1 AGENT
Has

M CUSTOMER ERER

An Agent can link to more than one Customer. But each Customer has only one Agent at a time.

Example:
Entity or Table: Agent (AgentCode, AgentName, AgentACode, AgentPhone) Primary Key : AgentCode Foreign Key : None Entity or Table: Customer (CustCode, CustFName, CustLName, CustACode, CustAddr, CustCity, CustPhone, AgentCode) Primary Key : CustCode Foreign Key : AgentCode

1) One to Many:
1
PAINTER
Paints

M PAINTING S

HAMDARD UNIVERSITY MAIN CAMPUS


FUNDAMENTAL OF INFORMATION SYSTEM
Description: A painter can paint many paintings. There is a 1 to M relationship between painter and paintings as there can be several paintings for a particular painter. Also a painting s belongs to only one painter. Table: (Painter) PainterNo (Primary Key) PainterName PainterFName PainterAddr PainterTel PainterQal PainterExp Table: (Paintings) PainterNo (Foreign Key) PaintingNo PaintingTitle PaintingDate PaintingDesc

2) Many to Many:
M
EMPLOYEE Learns

M
SKILL

Description: An employee may have several skills (BE, MCS, MBA) and one skill (MBA) can be found in many employees so there is many to many relationships between employee and skills. Table: (Emplyee) EmployeeNo (Primary Key) EmployeeName EmployeeFName EmployeeAddr EmployeeTel EmployeeQal EmployeeExp Table: (Learning) LearnNo SkillNo (Foreign Key) EmployeeNo (Foreign Key) Table: (Skills) SkillNo (Primary Key) SkillName SkillDesc

3) One to One:
1
EMPLOYEE Manage s

1
STORE

Description: Also an employee is a manager of a particular store but a store has only one manager and he is also an employee. So there is a (1,1) relationship. Table: (Emplyee) EmployeeNo (Primary Key) EmployeeName EmployeeFName EmployeeAddr EmployeeTel EmployeeQal EmployeeExp Table: (Store) StoreNo (Primary Key) StoreName StoreLoc StoreDesc

HAMDARD UNIVERSITY MAIN CAMPUS


FUNDAMENTAL OF INFORMATION SYSTEM The Entity Relationship Data Model:
The relational database models conceptual simplicity made it possible to expand the database scope. Complex design activities require conceptual simplicity to yield successful results. The entity relationship (E-R) Model yielded graphical representation of entities and their relationships in a database structure. It is precisely this graphical data representation that popularized the use of the E-R diagrams as a tool for conceptual level data modeling. The E-R model complemented the relational data model concepts, thus providing the foundation for a tightly structured database design environment to ensure the proper design of relational database.

Basic Concepts:
E-R models are normally represented in an entity relationship diagram (ERD). The ERD uses graphic representations to model the database components. An entity is a person, place or thing about which data are to be present to be collected and stored. An entity is represented by a rectangle in the E-R Model. Entity name is generally written in capital letters and is written in the singular PAINTER rather than PAINTERS. Each entity is described by a set of attributes. An attribute describes a particular characteristic of the entity. For example entity EMPLOYEE will have attribute such as Social Security Number, Last Name, First Name, Job, Hire Date, Salary, Commission, Department Number and Employee Number. A relationship describes an association among data. Most relationships describe association between two entities. We have discussed three types of relationships possible among data: one_to_many (1:M), many_to_many (M: N) and one_to_one (1:1). Relationships are represented by diamond connected to the related entities. The name of the relationship is written inside the diamond as follows:

One to Many:
1 PAINTER
Paints

M PAINTING S

Many to Many:
M EMPLOYE E Learn s M SKILL

One to One:
1 EMPLOYEE Mana ges 1 STORE

Entity And Attribute:


We have already discussed that entity is simply a person, place or thing for which we intend to collect data. Entities are grouped together to their common characteristics (attributes). Each entity has certain characteristics known as attributes. For example STUDENT entity might include the following attributes: student number, name, grade, gpa, date of enrollment, date of birth, address, phone number and so on. Similarly AIRCRAFT entity: aircraft number, date of last maintenance, total hours flown and flown since last maintenance.

HAMDARD UNIVERSITY MAIN CAMPUS


FUNDAMENTAL OF INFORMATION SYSTEM
Each attribute should be named appropriately to remind the user of its contents. For example if the entity is STUDENT, a student attribute data of birth might be stored as STU_DOB or the student home phone number might be stored as STU_HOME_PHONE.

Table And Their Characteristics:


A table is perceived as a two dimensional (2D) structured composed of rows and columns. The characteristics of a relational table are summarized as follows: 1) 2) 3) 4) 5) 6) A table is perceived as a two dimensional structure composed of rows and columns Each table row (tuple) represents a single entity occurrence within the entity set. Each table columns represents an attribute and each column has a distinct name Each row/columns intersection represents as single data value Each table must have an attribute or a combination of attribute that uniquely identifies each row All values in a column must conform to the same data format. For example if the attribute is assigned an integer data format, all values in the column representing that attribute must be integer 7) Each column has a specific range of values known as the attribute domain