Codd’s Rules in SQL
Codd’s Rules
Dr. Edgar F. Codd, in 1985, laid down 13 fundamental rules after doing large-scale research on the Relational Model of databases. According to him, every database must follow these rules to be considered as an accurate relational database (RDBMS). These 13 rules are referred to as Codd’s 12 Rules(Foundation rule is base for other rules).
The rules mentioned below are the 12 rules laid down by Codd:
Serial No. | Rule |
0 | Foundation Rule |
1 | Information Rule |
2 | Guaranteed Access Rule |
3 | Systematic Treatment of NULL Values |
4 | Active Online Catalog |
5 | Comprehensive Data SubLanguage Rule |
6 | View Updating Rule |
7 | High-level Insert, Update, Delete Rule |
8 | Physical Data Independence Rule |
9 | Logical Data Independence Rule |
10 | Integrity Independence |
11 | Distribution Independence |
12 | Non-Subversion Rule |
Let’s discuss each of the above rules in detail.
Foundation Rule
It states that the database should be capable of managing all the records through its relational abilities.
Information Rule
This rule states that the records that are saved in a database can be either user data or can be metadata. But that data must be present as a value in a cell in the database table. It is important that every record in a database is stored in a tabular format, that is, in the form of tables.
Guaranteed Access Rule
This rule states that it should be guaranteed that every atomic data in the database can be accessed with the help of a combination of the keys (primary key), the attribute names and the table name. Also, no other attributes other than these, like pointer, should be able to access the data.
Systematic Treatment of NULL Values
It states that every NULL value in a table should be dealt methodically and uniformly. A NULL can be looked upon as either absence of data or unknown data or data which is not applicable. Hence this is a fundamental rule that should be followed.
Active Online Catalog
It expresses that the definition about the structural description of the complete database should be kept in an online catalog. These catalogs are known as data dictionary and they can be retrieved only by users who have proper authorization. These catalogs can be retrieved by using the corresponding query language, which is used to operate the database.
Comprehensive Data Sub-Language Rule
It expresses that a database can only be accessed by a linear syntax language that hold up data definition, data manipulation, and transaction operations. This language can be used straight or by using other applications. Accessing the database without using a language is considered to be a violation.
View Updating Rule
It states that every view of a database should be revisable both theoretically and also by the system.
High-Level Insert, Update and Delete Rule
It states that every row of a database should hold up high-level insertion, updation, deletion, union, intersection, and minus behaviours to retrieve the data in the table.
Physical Data Independence
It mentions that the data stored in a database should not depend on the application. This implies that changes in the structure of the database should not affect the accessing of the data by applications external to the database.
Logical Data Independence
It, like the previous rule, states that the logical data in a database should not be dependent on the client’s application. This means that any change in the data should not impact the application. This rule is one of the most tough ones to implement.
Integrity Independence
This rule also mentions that a database should not be dependent on the application utilizing it. This means that all the integrity constraints of the database should be modifiable without the need for any change in the application.
Distribution Independence
This rule mentions that the user should not feel or be able to visualise that the data is spread over multiple locations. The user should always feel that the data is situated at one specific location only. This rule is regarded as the foundation for the distributed database systems.
Non-Subversion Rule
This rule states that if a system possesses an interface that lays out access to low-level records, then that interface should not have the authorization to destabilize the system including its security and integrity restrictions.
Thus, these are the 12 rules laid down by Dr. Edgar F. Codd, which should be followed by a database to be called truly relational (RDBMS).