DB Theo
DB Theo
Ch 1
Database Applications
Traditional Applications:
• Multimedia Databases
• Geographic Information Systems (GIS)
• Data Warehouses
• Real-time and Active Databases
• Many other applications
Database
Data
Information
Metadata
• Data that describe the properties or characteristics of end-user data and the context of those data
• The database definition or descriptive information is also stored by the DBMS in the form of a database
catalog or dictionary
• information stored in the catalog is called meta-data
• A software package/ system to facilitate the creation and maintenance of a computerized database.
• used to create, maintain, and provide controlled access to user databases
catalog
• contains information such as the structure of each file, the type and storage format of each data item, and
various constraints on the data.
Type of DB Models
• is a collection of tables that are related to one another based on a common field.
primary key(s)
foreign key
• the primary key of one table is represented in a second table to form a relationship
• may have multiple occurrences
• DBMS catalog stores the description of a database not only the database
itself but also a complete definition or description of the database (data structures, types, and constraints)
• The description is called meta-data.
• This allows the DBMS software to work with different database applications.
Data Abstraction
• A data model is used to hide storage details and present the users with a conceptual view of the database.
➢
➢ Programs refer to the data model constructs rather than data storage details
• Each user may see a different view of the database, which describes only the data of interest to that user.
Database Users
1. Database administrators
2. Database Designers
3. End-users
Database administrators:
• Responsible to define the content, the structure, the constraints, and functions or transactions against the
database
• They must communicate with the end-users and understand their needs
End-users:
• They use the data for queries, reports and some of them update the database content
data model
Entity
• noun in that it describes a person, a place, an object, an event, or a concept in the business environment for
which information must be recorded.
Attribute
Relationships
• A database that represents data as a collection of tables in which all data relationships are represented by
common values in related tables.
• understanding of a business situation and how information systems might help solve a problem or
make an opportunity possible
• Analyze current data processing
• Analyze the general business functions and their database needs
• Justify need for new data and databases in support of business
• Identify scope of database requirements for proposed information system
• Analyze overall data requirements for business function(s) supported by database.
2. Requirement Analysis
• Analyze situation to determine requirements, to structure those requirements, and to select among
competing system features
• Develop conceptual data model, including entities and relationships, attributes, and business rules
3. Conceptual Design
4. Logical Design
Purpose –information requirements structure
Structure :
Hierarchical DB
Network DB
Relational DB
Object Oriented
• Identify data integrity and security requirements.
• Analyze in detail the transactions, forms, displays, and inquiries (database views) required by the
business functions supported by the database
Deliverable – logical database design
5. Physical Design
6. Implementation
Purpose – testing, training, debugging, installation, documenting
• To write programs, build databases, test and install the new system, train users, and finalize
documentation.
Database implementation:
7. Maintenance
Purpose –monitor, repair, enhance
• To monitor the operation and usefulness of the system, and to repair and enhance the system
Database maintenance:
Analyze database and database applications to ensure that evolving information requirements are
met
Fix errors in database and database applications and recover database it.
Deliverable – periodic audits
Ch 2
The first step in database development is database analysis
database development
• is database analysis, in which we determine user requirements for data and develop data models to
represent those requirements.
• represents data from the viewpoint of the organization, independent of any technology
BUSINESS RULES
• Are the policies and rules about the operation of a business that a data model represents.
• Are statements that define some aspect of the business
• Are derived from policies, procedures, events, functions and state constraints on the organization
• Assert business structure
• Control/influence business behavior
• Are expressed in terms familiar to end users
• Are automated through DBMS software
• is most used as a tool for communications between database designers and end users during the analysis
phase of database development
• Entities
• Relationships
• Attributes.
Entities:
Relationships:
• instance–link between entity instances (corresponds to primary key-foreign key equivalencies in related
tables)
Attributes:
we present the main features of E-R modeling, using common notation and conventions
STRONG VERSUS WEAK ENTITY TYPES
identifying relationship
AN ENTITY
SHOULD BE:
• is a singular noun.
• specific to the organization.
• should be concise, using as few words as possible. (An abbreviation, or a short name)
• should be specified for each entity type name, and the abbreviation
Event entity types should be named for the result of the event, not the activity or process of the event.
The name used for the same entity type should be the same on all E-R diagrams on which the entity type appears.
Classifications of attributes:
A composite attribute
• An attribute that has meaningful component parts (attributes) which are more detailed attributes
• EX :Address
• an attribute that cannot be broken down into smaller components that are meaningful for the organization.
• Ex: Mail , Age
A multivalued attribute
• is an attribute that may take on more than one value for a given entity (or relationship) instance.
• is indicated with curly brackets around the attribute name
• EX : Phone number
Derived attribute
IDENTIFIERS (KEYS)
Identifier (Key)
• an attribute (or combination of attributes) that uniquely identifies individual instances of an entity type
Candidate Identifier
A composite identifier
MODELING RELATIONSHIPS
A relationship
• is an association representing an interaction among the instances of one or more entity types that is of
interest to the organization.
• has a verb phrase name.
DEGREE OF RELATIONSHIPS
Degree of a relationship
Unary Relationship
Binary Relationship
Ternary Relationship
CARDINALITY OF RELATIONSHIPS
One-to-One
• Each entity in the relationship will have exactly one related entity
One-to-Many
• An entity on one side of the relationship can have many related entities, but an entity on the other side will
have a maximum of one related entity
Many-to-Many
• Entities on both sides of the relationship can have many related entities on the other side
Cardinality Constraints
• the number of instances of one entity that can or must be associated with each instance of another entity
Minimum Cardinality
Maximum Cardinality
Ch 3
EER Model Concepts
• subclasses/superclasses
• specialization/generalization
• categories (UNION types)
• attribute and relationship inheritance
• model a general entity type (called the supertype) and then subdivide it into several specialized entity types
(called subtypes).
• EER diagrams extend ER diagrams to represent these additional subgroupings, called subclasses or
subtypes
• Each subtype inherits attributes from its supertype and in addition may have special attributes and be
involved in relationships of its own.
• It is not necessary that every entity in a supertype be a member of some subtype
Enhanced ER model:
Subtype:
• A subgrouping of the entities in an entity type that has attributes distinct from those in other subgroupings
Supertype:
• A generic entity type that has a relationship with one or more subtypes
Attribute Inheritance:
o Attributes that are shared by all entities are associated with the supertype.
o Attributes that are unique to a particular subtype are associated with that subtype.
The same is true for relationships.
o Relationships at the supertype level indicate that all subtypes will participate in the relationship
o The instances of a subtype may participate in a relationship unique to that subtype. In this situation, the
relationship is shown at the subtype level.
• When there are attributes that apply to some (but not all) of the instances of an entity type
• When the instances of a subtype participate in a relationship unique to that subtype
Attribute Inheritance
• The property by which subtype entities inherit values of all attributes of the supertype.
Generalization And Specialization
Generalization:
• The process of defining a more general entity type from a set of more specialized entity types.
• BOTTOM-UP
• is the reverse of the specialization process Several classes with common features are generalized into a
supertype
• Example: CAR, TRUCK generalized into VEHICLE
Specialization:
• The process of defining one or more subtypes of the supertype and forming supertype/subtype
relationships.
• TOP-DOWN
• called specific or local attributes.
• The set of subtypes is based upon some distinguishing characteristics of the entities in the supertype
• Example: {SECRETARY, TECHNICIAN} is a specialization of EMPLOYEE based upon job type.
• May have several specializations of the same supertype
• The subtype can also participate in specific relationship types.
1. Disjointness Constraint
2. Completeness Constraint
Disjointness Constraint:
Whether an instance of a supertype may simultaneously be a member of two (or more) subtypes
• Disjoint Rule: An instance of the supertype can be only ONE of the subtypes
• Overlap Rule: An instance of the supertype could be more than one of the subtypes
Completeness Constraint:
• Total specifies that every entity in the supertype must be a member of at least one subtype in the
specialization/generalization
o Shown in EER diagrams by a double line
• Partial allows an entity not to belong to any of the subtypes
o Shown in EER diagrams by a single line
Generalization usually is total because the superclass is derived from the subclasses.
Subtype Discriminator:
Disjoint
Overlapping
Each subpart contains a Boolean value to indicate whether or not the instance belongs to the associated subtype
Ch 4
Relational data model
Relation
A table consists of
• rows (records)
• columns (attribute or field)
• An entry at the intersection of each row and column is atomic (or single valued).There can be only one
value associated with each attribute on a specific row of a table; no multivalued attributes are allowed in a
relation.
• Every row must be unique (can’t have two rows with exactly the same values for all their fields).
• Attributes (columns) in tables must have unique names.
NOTES:
• The word relation (in relational database) is NOT the same as the word relationship (in E-R model).
• Relations (tables) correspond with entity types.
• Rows correspond with entity instances.
• Columns correspond with attributes
Key Fields
1- Primary keys
• unique identifiers of the relation in question.
• Ex: employee numbers, social security numbers
2- Foreign keys
• identifiers that enable a dependent relation (on the many side of a relationship) to refer to its parent
relation (on the one side of the relationship)
Keys
Schema:
• in which each relation is named and the names of its attributes follow in parentheses.
A graphical representation
• in which each relation is represented by a rectangle containing the attributes for the relation
• Domain constraints
• Entity integrity constraints
• Referential integrity constraints
Domain Constraints
• All of the values that appear in a column of a relation must be from the same domain. (or it could be null, if
allowed for that attribute).
• is the set of values that may be assigned to an attribute.
A domain definition consists of the following components:
domain name, meaning, data type, size (or length), and allowable values or allowable range.
Entity Integrity
• The entity integrity rule is designed to ensure that every relation has a primary key.
• No primary key attribute may be null. All primary key fields MUST have data.
Referential Integrity
• rule states that any foreign key value (on the relation of the many side) MUST match a primary key value
in the relation of the one side. (Or the foreign key can be null)
• For example: Delete Rules
Regular entities:
• are entities that have an independent existence and generally represent real-world objects, such as persons
and products.
• rectangles with a single line.
Weak entities:
• are entities that cannot exist except with an identifying relationship with an owner (regular) entity type.
• by a rectangle with a double line.
Associative entities:
Simple attributes:
Composite attributes:
Multivalued Attribute:
• Becomes a separate relation with a foreign key taken from the superior entity
Mapping Weak Entities
• One relation for each entity and one for the associative entity