Your SlideShare is downloading. ×
0
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Chapter 2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Chapter 2

947

Published on

PB204 Database Application Jabatan Perdagangan Politeknik Seberang Perai

PB204 Database Application Jabatan Perdagangan Politeknik Seberang Perai

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
947
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
75
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. PB204 Jabatan Perdagangan POLITEKNIK SEBERANG PERAI DATABASE APPLICATION
  • 2. DATA MODELLING 2.0
  • 3. Entity Relationship Diagram
    • What is Entity?
      • “ An entity is a business object that represents a group, or category of data.”
    • Object
    • Place
    • Person
    • Event
  • 4. Entity Relationship Diagram (cont.)
    • Entity Set/Type
      • Set of entities of the same type that share the same attributes.
    STUDENT A STUDENT B STUDENT C STUDENT D Mr. A Mr.D Mr. C Mr. B ENTITY SET : STUDENT ENTITY SET : TEACHER
  • 5. Entity Relationship Diagram (cont.)
    • What is Relationship?
      • Meaningful association among several entities.
    • What is Relationship Type?
      • A set of relationship of the same type.
  • 6. Entity Relationship Diagram (cont.) Student A ENTITY SET : STUDENT Student B Student B Mr A Mr B Mr B ENTITY SET : TEACHER RELATIONSHIP SET : SUBJECT
  • 7. Entity Relationship Diagram (cont.)
      • What is Attribute?
      • “ An attribute is a sub-group of information within an entity.”
      • Descriptive properties possessed by each member of an
      • entity set.
  • 8. Entity Relationship Diagram (cont.)
      • Types of Attributes
      • Single and composite:
        • Roll number is an example of single attribute as it can not
        • be divided further.
        • Name can be divided further into 3 parts consisting of first
        • name , middle name , last name so it is an example of
        • composite attribute.
      • Single valued and multivalued:
        • The attributes which have single value are single valued attributes such roll number.
        • The attributes which has a set of values are called multivalued attributes. Such as any student can have more than 1 telephone number .
  • 9. Entity Relationship Diagram (cont.)
      • Types of Attributes
      • Derived attributes:
        • These attributes are derived from the existing attributes of
        • entities.
        • The value of a derived attribute is not stored , but
        • computed when required.
      • Descriptive attribute:
        • The attribute of the relationship is called descriptive
        • attribute.
  • 10. Entity Relationship Cardinality
    • It expresses the number of entities to which another entity
    • can be associated via a relationship set.
      • One to many
      • Many to one
      • One to one
      • Many to many
  • 11. ONE TO MANY A B a1 a4 a2 a3 b4 b3 b2 b1
  • 12. MANY TO ONE A B b2 a1 a2 a5 b3 b2 b1 a3 a4
  • 13. ONE TO ONE A B a1 a2 a3 a4 b4 b3 b2 b1
  • 14. MANY TO MANY A B a1 a3 a2 b4 b3 b2 b1 a4
  • 15. ROLE
    • Not specified when entity sets that participate in a relationship set are distinct.
    • Clarification is needed only when the entity sets of a relationship set are not distinct.
    The function that an entity plays in a relationship is called that entity’s role. RECURSIVE RELATIONSHIP When entities are self-linked then such a relationship is called a recursive relationship.
  • 16. TOTAL PARTICIPATION The participation of an entity set E in a relationship set R is said to be TOTAL if every entity in E participates in at least one relationship in R. Student A ENTITY SET : STUDENT Student B Student B Mr A Mr B Mr B ENTITY SET : TEACHER RELATIONSHIP SET : SUBJECT
  • 17. PARTIAL PARTICIPATION Mr A ENTITY SET : DEPARTMENT Mr B Mr B PB204 P2113 BBC101 ENTITY SET : COURSES RELATIONSHIP SET : COURSE The participation an entity set E in a relationship set R is said to be PARTIAL if only some entities in E participate in relationships in R.
  • 18. Weak entity set
    • Existence of weak entity set depends on the existence of a strong entity set which is called the identifying entity set.
    • The relationship is always many-to-one from weak to identifying.
    • Participation of the weak entity set in the relationship must be total.
    An entity set that does not have sufficient attributes to form a primary key is referred to as a weak entity set.
  • 19. Types of Keys
    • A key is a set of columns that can be used to identify or
    • access a particular row or rows
    • The key is identified in the description of a table, index, or
    • referential constraint
    • The same column can be part of more than one key
    • A unique key is a key that is constrained so that no two of its
    • values are equal.
    • The columns of a unique key cannot contain NULL values.
    • For example, an employee number column can be defined as
    • a unique key, because each value in the column identifies
    • only one employee. No two employees can have the same
    • employee number.
  • 20. Types of Keys (cont.)
    • Candidate Key
      • All available unique , required identifiers of an entity
    • Primary Key
      • A unique, required identifier of an entity
      • The best one of candidate keys
    • Foreign Key
      • A reference key to another entity
      • This key is the primary key of another entity
      • A table can have many foreign keys
      • A foreign key is nullable if any part is nullable
      • A foreign key value is null if any part is null
  • 21. Types of Keys (cont.)
    • Natural primary key:
    • A natural primary key is one that exists in the data itself.
    • Surrogate primary key:
    • The primary key that you have created where non existed before.
    • Primary key requires the consideration not just of the current data, but of possible future data as well.
    Primary Key
  • 22. Types of Keys (cont.)
    • The primary key is the main “Handle” that the database server uses to grab the information in which you are interested.
    • By identifying a primary key, you are telling the server which information you want to work with at the moment.
    Why is it important to identify primary key?
  • 23. Types of Keys (cont.)
    • A primary key of one table that is included in another table.
    • Links the records in one database table to another table.
    Foreign Key
  • 24. End Of Chapter 2

×