Data Model
Different types of data model Entity – Relationship (E-R) Model. Relational Model Object –Based Data Model Semi structured Data Model Network Model Hierarchical data model
The Entity Relationship Model ER Model consists of a collection of basic objects called entities Relationships among these objects.
Relational Model The relational model uses a collection of tables to represent both data and the relationships among those data. It is record based model Each table contains records ( fields or attributes)
Relational Model (cont…) Advantage : Structure independence Conceptual (Theoretical) Simplicity A powerful database management system Disadvantage Transaction Process is not efficient Processing time is low
Object –Based Data Model The object oriented model can be seen as extending the E-R model with notions of encapsulation methods (functions) and object identity.
Object –Based Data Model (cont…) Advantage : Exceptional conceptual simplicity Visual representation Effective communication tool Integrated with the relational database model Disadvantage Limited constraint representation Limited relationship representation No data manipulation language Loss of information content
Semi structured data model The semi structure data model permits the specification of data where individual data items of the same type have different set of attributes. Example XML ( Extensible Markup Language)
Network Model It is data structure diagram Advantage Disadvantage Data independence Conceptual simplicity Easy to design Disadvantage Lack of structure independence
Hierarchical Model It uses tree structure diagram Advantage Simple Easy to update Design is simple Database security Efficiency Disadvantage Implementation complexity Difficult to manage
Database Languages
Database Languages A database system provides two different types of languages. They are Data Definition Language To specify the database schema Data Manipulation Language To express database queries and updates
Data Definition Language Specifies the database schema by a set of definitions Result of compilation of DDL statements is a set of tables that is stored in a special file called data dictionary.
Active data dictionary A data dictionary is a file that contains metadata (that is data about data). This file is consulted before actual data are read or modified in the database system. Active data dictionary Created and maintained automatically by the DBMS Passive Data dictionary Managed by users used more during design and development stage
Data dictionary should contain information about Data structures and types of data Domain information about each attribute (columns) Their relation to other entities (Require a user to specify what data are needed from tables) Documentary and technical information regarding systems and design features. Access Control information Details of logic structures that are mapped into the database Resource usage detail
Referential Integrity The data values stored in the database must satisfy certain consistency constraints Domain constraints Example Integer types, character types, date and time types. Referential Integrity Refer another table or attribute Min balance Rs 1000 Authorization Permit access (read, insert, update, delete)
Data Manipulation Language (DML) DML is a language that enables users to access or manipulate data as organized by the appropriate data model. Retrieval of information stored in the database. Insertion of new information Deletion of information Modification of information DML Procedural Non procedural (Declarative)
Procedural DMLs Non Procedural DMLs Require a user to specify what data are needed and how to get those data. Non Procedural DMLs Require a user to specify what data are needed without specifying how to get those data.