Docsity

Database Management: Entities, Relationships, and Primary Keys, Lecture notes of Database Management Systems (DBMS)

Partial preview of the text

Download Database Management: Entities, Relationships, and Primary Keys and more Lecture notes Database Management Systems (DBMS) in PDF only on Docsity!

Introduction to Database

IS 312

What Is a Database?

Database is a computer technique that

store and retrieve data effectively(e.g.

ATM)

A database is a collection of tables

Database Structure

. Entity , Table , Relation

. Row , Tuple , Record

. Column, Field , Attribute

. Relationship between Tables

. Primary Key

. Foreign Key

Entity Relationship (ER) Diagram

A detailed, logical representation of the

entities, associations and data

elements for an organization or business

Notation uses three main constructs

Data entities

Relationships

Attributes

Chen Model & Crow’s Foot Model

Entities

: Examples of entities Person: EMPLOYEE, STUDENT, PATIENT Place: STORE, WAREHOUSE Object: MACHINE, PRODUCT, CAR Event: SALE,REGISTRATION, RENEWAL Concept: ACCOUNT, COURSE Guidelines for naming and defining : entity types An entity type name is a singular noun An entity type should be descriptive and specific An entity name should be concise

Attributes

: Example of entity types and associated attributes

STUDENT: Student _ ID, Student _ Name, Home _ Address, Phone _ Number, Major

: Guidelines for naming attributes

. An attribute name is a noun An attribute name should be unique To make an attribute name unique and clear, each attribute name should follow a standard format Similar attributes of different entity types should use similar but distinguishing names

Cardinality and

Connectivity

Relationships can be classified as either

one – to – one
one – to – many
many – to –many

Cardinality : minimum and maximum number of instances of Entity B that can (or must be) associated with each instance of

. entity A

Connectivity

Professor teaches Class 1 M Connectivity )1,1 ( )1,4( Cardinality

Mandatory vs. Optional Cardinalities Specifies whether an instance must exist or can be absent in the relationship

. A Lecturer may handle zero or many classes . A class is handled by one and only one Lecturer MandatoryMandatory Optional Optional Lecturer Class )1,1 ( (N, 0 ) handles (^1) M

Binary

Relationships

relationship 1: A single entity instance in one entity class is related to a single entity instance in another entity class Could indicate that two entities actually belong in the same table

M relationship: 1

Relational modeling ideal

Should be the norm in any relational

database design

The 1: M relationship between PAINTER and PAINTING

M:N relationships Must be avoided because they lead to data

. redundancies Can be implemented by breaking it up to produce a set of 1:M relationships Can avoid problems inherent to M:N relationship by creating a composite entity or bridge entity This will be used to link the tables that were originally related in a M:N relationship The composite entity structure includes-as f oreign keys-at least the primary keys of the . tables that are to be linked