PromleeBlog

posting thumbnail
Database Design and Implementation

📅

Database 🔗

A collection of data an organization needs and owns, maintains, and uses jointly.

Components of a Data Model 🔗


Schemas 🔗

TypeDescription
Conceptual schemaDefines the entire database from the users' and database administrator's perspective.
Specifies entities, relationships, constraints, access rights, and integrity rules.
Internal schemaDescribes the database from the designer's or developer's perspective and defines how the conceptual schema is implemented on physical storage.
Specifies physical structure and the physical order of internal records.
External schemaDescribes the database from a user's perspective. Different users and programs can have different logical views.

E-R Diagram Notation 🔗

240508-174919

Relational Databases 🔗

Properties of a relation

Keys 🔗

TypeDescription
Candidate keyA key that satisfies
uniqueness
and
minimality
.
Primary keyThe candidate key chosen as the main key. Its values cannot be
duplicate or NULL
.
Alternate keyA candidate key other than the primary key.
Foreign keyAn attribute that references a primary key in another relation. The referenced key is unique, but foreign-key values in the referencing relation may repeat.
SuperkeyA set of attributes that uniquely identifies tuples in a relation.

Integrity 🔗

TypeDescription
Entity integrity
No attribute in the
primary key
can be
NULL
, and the key must be unique.
Domain or attribute integrity
Attribute values must belong to the defined
domain
.
Referential integrity
A
foreign key
value is either NULL or matches a primary key value in the referenced relation.
User-defined integrityData must satisfy the integrity rules defined by users.
Enforcing data integrityConstraints help ensure that data is accurate, consistent, and valid.

Relational Algebra 🔗

A
procedural language
that defines how to retrieve the desired information.
  1. Relational operators
    SymbolOperatorDescription
    σSelectSelects tuples that satisfy a condition.
    πProjectSelects specific attributes from a set of tuples.
    ⋈JoinJoins two relations based on common attributes.
    ÷DivisionDivides one relation by another.
  2. General set operators
    SymbolOperatorDescription
    ∪UnionReturns the union of two relations.
    ∩IntersectionReturns the intersection of two relations.
    -DifferenceReturns the set difference of two relations.
    xCartesian productCombines each tuple in one relation with each tuple in the other.

Relational Calculus 🔗

A
nonprocedural language
that describes the information to retrieve.
  1. Logical operators
    SymbolOperatorDescription
    ∧ANDTrue when both conditions are true.
    ∨ORTrue when at least one condition is true.
    ¬NOTNegates a condition.
  2. Quantifiers
    SymbolOperatorDescription
    ∀For allThe condition holds for every tuple.
    ∃There existsThe condition holds for at least one tuple.

Normalization 🔗

A process for minimizing redundancy and preserving data integrity.

Normal Forms 🔗

  1. First normal form requires every
    domain
    to contain only
    atomic values
    .
  2. Second normal form requires non-key attributes to be
    fully functionally dependent
    on the primary key, eliminating
    partial dependencies
    .
  3. Third normal form eliminates
    transitive functional dependencies
    of non-key attributes on the primary key.
  4. Boyce–Codd normal form (BCNF) requires every determinant to be a
    candidate key
    .
  5. Fourth normal form addresses
    multivalued dependencies
    by requiring the determinant of each nontrivial multivalued dependency to be a superkey.
  6. Fifth normal form requires every
    join dependency
    to follow from the candidate keys.

Data Dictionary and System Catalog 🔗

System tables maintain definitions and specifications for all data objects.

Indexes 🔗

An ordered data structure built separately to make records quicker to locate and retrieve.
When a table is dropped, its indexes must also be removed. Users can manage indexes directly.
Use CREATE to create an index and DROP to remove it.
Types include clustered, nonclustered, tree-based, function-based, bitmap, bitmap join, and domain indexes.
    Database Design and Implementation | PromleeBlog