1. TYPES OF DATA MODELS AND THEIR EVOLUTION
1.1. Object-based Data Model
1.1.1. Entity-Relationship (ER)
1.1.1.1. model the data based on entities and their relationships (including their attributes and constraints) in a non technical and free of ambiguities way.
1.1.2. Semantic
1.1.2.1. models that represent more of the meaning of data.
1.1.3. Functional
1.1.3.1. one of the family of semantic data model which model the data based on the entities and functional relationships.
1.1.4. Object-oriented
1.1.4.1. extends the definitions of an entity to include not only the attributes that describe the state of the object but also the actions that are associated with the object, that it, its behavior.
1.2. Record-based Data Model
1.2.1. Relational Data Model
1.2.1.1. Data and relationships are represented as tables, each of which has a number of columns with unique name.
1.2.2. Network Data Model
1.2.2.1. Data is represented as collections of records and relationships are represented by sets.
1.2.3. Hierarchical Data Model
1.2.3.1. Data is represented as a collection of records and relationships are represented by sets.
1.2.4. Comparisons between Relational, Network and Hierarchy Data Model
1.2.4.1. The majority of modern commercial systems are based on the relational paradigm, whereas early database systems were based on either the network or hierarchical data models.
1.2.4.2. The majority of modern commercial systems are based on the relational paradigm, whereas early database systems were based on either the network or hierarchical data models.
1.2.4.3. Hence, relational systems adopt a declarative approach to database processing (that is, they specify what data is to be retrieved), but network and hierarchical systems adopt a navigational approach (that is they specify how the data is to be retrieved).
1.3. Physical Data Model (Low level Data Model)
1.3.1. Describes how data is stored in the computer, representing information such as record structures, record ordering and access paths.
2. THE RELATIONAL MODEL
2.1. In the relational data model, all data is logically structured within relations (tables). Each relation has a name and is made up of named attributes (columns) of data. Each tuple (row) contains one value per attributes.
2.1.1. Terminology
2.1.1.1. Relation
2.1.1.1.1. A relation(sometimes called file) is a table with column and rows.
2.1.1.2. Attribute
2.1.1.2.1. An attribute (sometimes called field) is a named column of a relation.
2.1.1.3. Domain
2.1.1.3.1. A domain is the set of allowable values for one or more attributes
2.1.1.4. Tuple
2.1.1.4.1. A tuple is a row of a relation (sometimes called record)
2.1.1.5. Degree
2.1.1.5.1. The degree of a relation is the number of attributes it contains.
2.1.1.6. Cardinality
2.1.1.6.1. The cardinality of a relation is the number of tuples it contains
2.1.1.7. Relational Database
2.1.1.7.1. A relational database is a collection of normalized relations with distinct relation names.
2.1.2. Mathematical Relations
2.1.2.1. The Cartesian product of these two sets, written D1 x D2, is the set of all ordered pairs such that the first element is a member of D1 and the second element is the member of D2.
2.1.3. Database Relations
2.1.3.1. Relation schema
2.1.3.1.1. Let A1,A2,…..,An be attributes with domain D1, D2,…..Dn. Then set { A1 : D1 , A2 : D2 ,……, An : Dn} is a relation schema.
2.1.3.2. Relational database schema
2.1.3.2.1. If R1,R2,….Rn are set of relation schema, then we can write the relational database schema or simply relational schema, R, as; R = { R1,R2,….Rn }
2.1.4. Properties of Relations
2.1.5. Relational Keys
2.1.5.1. Superkey
2.1.5.1.1. An attribute, or set of attributes, that uniquely identify a tuple within a relation.
2.1.5.2. Candidate key
2.1.5.2.1. A superkey such that no proper subset is a superkey within the relation.
2.1.5.3. Primary key
2.1.5.3.1. The candidate key that is selected to identify tuples uniquely within the relation.
2.1.5.4. Foreign key
2.1.5.4.1. An attribute, or set of attributes, within one relation that matches the candidate key of some (possibly the same) relation.
2.1.6. Representing Relational Database Schemas
2.1.6.1. A relational database consists of any number of normalized relations.
2.1.7. Integrity Constraints
2.1.7.1. a data model has two other parts: a manipulative part, defining the types of operation that are allowed on the data, and a set of integrity constraints, which ensure that the data is accurate. In this section we discuss the relational integrity constraints.
2.1.7.1.1. Nulls
2.1.7.1.2. Entity Integrity
2.1.7.1.3. Referential Integrity
2.1.7.1.4. General Constraints