- A data model is a collection of high-level data description constructs that hide many low-level storage details
- A semantic data model is a more abstract, high-level data model that makes it easier for a user to come up with a good initial description of the data in an enterprise.
- A database design in terms of a semantic model serves as a useful starting point and is subsequently translated into a database design in terms of the data model the DBMS actually supports.
- A widely used semantic data model called the entity-relationship (ER) model allows us to pictorially denote entities and the relationships among them
1.5.1 The Relational Model
- The central data description construct in this model is relation, which can be thought of as a set of records.
- A description of data in terms of a data model is called a schema.
- The schema for a relation specifies its name, the name of each field or attribute or column.
- Example: student information in a university database my be stored in a relation with the following schema (with 5 fields):
- Students(sid: string, name: string, login: string, age: integer, gpa: real)
- An example instance of the Students relation:
sid name login age gpa 53666 Jones jones@cs 18 3.4 53588 Smith smith@ee 18 3.2
- Each row in the Students relation is a record that describes a student. Every row follows the schema of the Student relation and schema can therefore be regarded as a template for describing a student.
- We can make the description of a collection of students more precise by specifying integrity constraints, which are conditions that the records in a relation must staisfy.
- Other notable models: hierarchial model, network model, object-oriented model, and the object-relational model.
1.5.2 Levels of Abstraction in a DBMS
- A data definition language (DDL) is used to define the external and conceptual schemas.
- Information about conceptual, external, and physical schemas is stored in the system catalogs.
- Any given database has exactly one conceptual schema and one physical schema because it has just one set of stored relations, but it may have several external schemas, each tailored to a particular group of users.
- The conceptual schema (sometimes called the logical schema) describes the stored data in terms of the data model of the DBMS.
- Relations contain information about entities and relationships
- The physical schema specifies additional storage detail, summarizes how the relations described in conceptual schema are actually stored on secondary storage devices such as disks and tapes.
- Decide what file organizations to use to store the relations, then create indexes to speed up data retrieval operations.
- External schemas allow data access to be customized and authorized at the level of individual user or groups of users.
- Each external schema consists of a collection of views and relations from the conceptual schema.
- A view is conceptually a relation, but the records in a view are not stored in the DBMS. The records are computed using a definition for the view, in terms of relations stored in the DBMS.
- The external schema design is guided by the end user requirements.
1.5.3 Data Independence
- Data independence is achieved through the use of the three levels of data abstraction; in particular, the conceptual schema and the external schema provide distinct benefits in this area.
- Logical data Independence:
- Users can be shielded from changes in the logical structure of the data, or changes in the choice of relations to be stored.
- Example: Student_public, Student_private => create levels using views in external schema
- Physical data independence:
- The conceptual schema insulates users from changes in the physical storage of the data.
- The conceptual schema hides details such as how the data is actually laid out on disk, the file structure, and the choice of indexes.