Data View, Models and Languages

Data View, Models and Languages

Published by: Sareena Kumari Basnet

Published date: 23 Jul 2024

Data View, Models and Languages

View of Data- Data Abstraction

A database system is a collection of interrelated data and a set of programs that allow users to access and modify these data. A major purpose of a database system is to provide users with an abstract view of the data. That is, the system hides certain details of how the data are stored and maintained.
For the system to be usable, it must retrieve data efficiently. The need for efficiency has led designers to use complex data structures to represent data in the database.
Since many database-system users are not computer trained, developers hide the complexity from users through several levels of abstraction, to simplify users' interactions with the system:

 
 

  • Physical level: The lowest level of abstraction describes how the data are actually stored. The physical level describes complex low-level data structures in detail.
  • Logical level: The next-higher level of abstraction describes what data are stored in the database, and what relationships exist among those data. Database administrators, who must decide what information to keep in the database, use the logical level of abstraction.
  • View level: The highest level of abstraction describes only part of the entire database. Even though the logical level uses simpler structures, complexity remains because of the variety of information stored in a large database. Many users of the database system do not need all this information; instead, they need to access only a part of the database. The view level of abstraction exists to simplify their interaction with the system. The system may provide many views for the same database.

Data Models

Data Model a collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraints. A data model provides a way to describe the design of a database at the physical, logical, and view levels. The data models can be classified into four different categories:

Relational Model

  • The relational model uses a collection of tables to represent both data and the relationships among those data.
  • Each table has multiple columns, and each column has a unique name. Tables are also known as relations. Each table contains records of a particular type. Each record type defines a fixed number of fields, or attributes.
  • The columns of the table correspond to the attributes of the record type. The relational data model is the most widely used data model, and a vast majority of current database systems are based on the relational model.

Entity-Relationship Model

The entity-relationship (E-R) data model uses a collection of basic objects, called entities, and relationships among these objects. An entity is a "thing" or "object" in the real world that is distinguishable from other objects. The entity-relationship model is widely used in database design.

Object-Based Data Model

Object-oriented programming (especially in Java, C++, or C#) has become the dominant software-development methodology. This led to the development of an object-oriented data model that can be seen as extending the E-R model with notions of encapsulation, methods (functions), and object identity. The object-relational data model combines feature of the object-oriented data model and relational data model.

Semistructured Data Model

The semistructured data model permits the specification of data where individual data items of the same type may have different sets of attributes. The Extensible Markup Language (XML) is widely used to represent semistructured data.

Historically, the network data model and the hierarchical data model preceded the relational data model. These models were tied closely to the underlying implementation, and complicated the task of modeling data. As a result, they are used little now, except in old database code that is still in service in some places.

Database Languages

A database system provides a data-definition language to specify the database schema and a data-manipulation language to express database queries and updates.

Data-Manipulation Language(DML)

A data-manipulation language (DML) is a language that enables users to access or manipulate data as organized by the appropriate data model.
Examples of DML:

  • SELECT - is used to retrieve data from the a database.
  • INSERT - is used to insert data into a table.
  • UPDATE - is used to update existing data within a table.
  • DELETE - is used to delete records from a database table.

There are basically two types:

  • Procedural DMLS require a user to specify what data are needed and how to get those data.
  • Declarative DMLs (also referred to as nonprocedural DMLs) require a user to specify what data are needed without specifying how to get those data.

Data-Definition Language (DDL)

DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema.
It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in database.
Examples of DDL commands:

  • CREATE- is used to create the database or its objects (like table, index, function, views, store procedure and triggers).
  • DROP- is used to delete objects from the database.
  • ALTER- is used to alter the structure of the database.
  • TRUNCATE- is usePage en 10 we all 90cords from tablet including all spaces allocated for the records are removed.
  • COMMENT- is used to add comments to the data dictionary.
  • RENAME- is used to rename an object existing in the database.

Data Control Language (DCL)

DCL includes commands such as GRANT and REVOKE which mainly deals with the rights, permissions and other controls of the database system.

Examples of DCL commands:

  • GRANT-gives user's access privileges to database.
  • REVOKE-withdraw user's access privileges given by using the GRANT command.

Transaction Control Language (TCL)

TCL commands deals with the transaction within the database.
Examples of TCL commands:

  • COMMIT-commits a Transaction.
  • ROLLBACK-rollbacks a transaction in case of any error occurs.
  • SAVEPOINT- sets a save point within a transaction.
  • SET TRANSACTION- specify characteristics for the transaction.

Instances and Schemas

Instances

  • Definition: An instance refers to the actual content of the database at a particular moment in time. It is a snapshot of the data stored in the database.
  • Dynamic Nature: Instances are dynamic and can change frequently as data is added, modified, or deleted.
  • Example: Consider a database for a library system. The instance includes all the current records of books, borrowers, and transactions at a specific time.

Schemas

  • Definition: A schema is the logical structure of the database. It defines how the data is organized and how the relationships among data are associated.
  • Static Nature: Schemas are relatively static and change infrequently. They serve as a blueprint or framework for the database.
  • Types of Schemas:
    • Physical Schema: Defines how the data is stored on the physical storage devices.
    • Logical Schema: Defines the logical constraints and structure of the data, such as tables, views, and relationships. It is independent of the physical aspects.
    • View Schema: Defines how the data is presented to different users, specifying different views for different purposes.
    • Example: In the library system, the schema would include definitions for tables like Books, Borrowers, and Transactions, along with the columns and data types for each table and the relationships between these tables.

FAQs About Topic
The relational data model organizes data into tables (or relations), which consist of rows and columns. Each table represents a specific entity type, and relationships between tables are established through foreign keys.
Database languages are specialized languages used to define, manipulate, control, and query data in a database. They include: Data Definition Language (DDL) Data Manipulation Language (DML) Data Control Language (DCL) Transaction Control Language (TCL)
Physical Level: Describes how data is stored in the database. Logical Level: Describes what data is stored in the database and the relationships among those data. View Level: Describes only a part of the entire database, tailored to the needs of specific users.