Database Constraints: Database constraints are like conditions given to the manipulation of values of a field or attribute. Such as, we may limit the values under the payment attribute of a table that its value can never be less than BDT 350. Constraints can be tested as follows,
- Domain Constraints: Using domain constraints one can declare the type of data which will be allowed to insert under a following attributes. Such as if we want that the value under the orders attribute is an integer then we can constraint the attribute by using integer type. This is the most elementary form of integrity constraints and easily tested by system.
- Referential Integrity: There are cases where we wish to ensure that a value that appears in one relation for a given set of attributes will also appear for a certain set of attributes in another relation. This is called referential integrity.
- Assertion: An assertion is any condition that the database always must satisfy. Such as, โEvery loan has at least one customer who maintains an account with a minimum balance of BDT 1500โ โ this is an assertion. If the system found an assertion valid, then no modifications get allowed when it violets the assertion.
- Authorization: Access of users is also necessary. Such as, we specify the read authorization so that a user will only be able read data, but will not be able to insert, delete or modify data. Similarly, Insert Authorization will allow data insertion but no modifications, Update Authorization will allow modifications, but no deletion of data and the Delete Authorization will allow deletion. We can assign the user one, none or any combination of these authorizations.