Transaction, Integrity Constraints and Authorization

Transaction, Integrity Constraints and Authorization

Published by: Sareena Kumari Basnet

Published date: 29 Jul 2024

Transaction, Integrity Constraints and Authorization

A transaction in Database Management Systems (DBMS) can be defined as a collection of logically related activities. It is the result of a user's request to access and operate on the database's contents. It consists of numerous activities and stages throughout its completion journey. It also has some unique attributes that must be observed to ensure database consistency.

Transaction Management

Commit: A commit operation makes all of a transaction's changes permanent. It represents the successful completion of a transaction and the release of any locks that were held throughout the transaction.

Rollback: A rollback operation reverses any changes made by a transaction, returning the database to its previous state before the transaction began. Rollback is used to keep databases consistent in the event of mistakes or failures.

Integrity Constraints

Integrity constraints are a set of predetermined restrictions intended to ensure that information is of high quality. Integrity constraints require that data insertion, updating, removing, and other activities be carried out in such a way that data integrity is not affected.

Types of Integrity Constraints

Not null: Ensures that a column cannot contain a NULL value. This constraint enforces the requirement that a column always have a value.

Unique: Ensures that each value in a column is unique across all rows in the table. This constraint avoids duplicate values.

Check: Ensures that all values in a column meet a specified criterion. For example, a CHECK constraint can require that a column value be greater than zero.

Referential Integrity: Ensures that a foreign key value always corresponds to an existent entry in another table. This constraint ensures that data is consistent and accurate across related tables.

Authorization

Authorization in DBMS ensures that users have the necessary permissions to access and manipulate database items.

Grant and Revoke

  1. Grant: Provides specific privileges to users or roles.
    Example: GRANT SELECT, INSERT ON employees TO user1;

  2. Revoke: Removes specific privileges from users or roles.
    Example: REVOKE SELECT, INSERT ON employees FROM user1;

 

FAQs About Topic
COMMIT: Saves all of the transaction's changes permanently. ROLLBACK: Undoes all changes made by the transaction, returning the database to its state before the transaction began.
Integrity constraints are a set of predetermined restrictions intended to ensure that information is of high quality.
Authorization in DBMS ensures that users have the necessary permissions to access and manipulate database items.