SQL Tutorial

SQL Tutorial SQL Introduction SQL Syntax SQL Data Types SQL OPERATORS SQL COMMANDS SQL Queries

SQL Database

SQL Create Database SQL DROP Database SQL SELECT Database

SQL Table

SQL TABLE SQL CREATE TABLE SQL COPY TABLE SQL ALTER TABLE SQL DELETE SQL TRUNCATE TABLE SQL DROP TABLE SQL UPDATE TABLE SQL INSERT TABLE

SQL SELECT

SQL SELECT Statement SQL SELECT WHERE Clause SQL SELECT IN Operator SQL BETWEEN Operator SQL SELECT BETWEEN Operator SQL SELECT AND Operator SQL SELECT OR Operator SQL SELECT LIKE Operator SQL SELECT DISTINCT SQL SELECT SUM SQL SELECT MAX SQL SELECT MIN SQL SELECT AVG

SQL Clause

SQL WHERE Clause SQL GROUP BY CLAUSE SQL ORDER BY Clause SQL HAVING Clause

SQL INSERT

SQL INSERT Statement SQL INSERT INTO Statement SQL INSERT INTO Values SQL INSERT INTO SELECT SQL Insert multiple rows

SQL JOIN

SQL JOIN SQL Inner Join SQL Left Join SQL Right Join SQL Full Join SQL CROSS Join

SQL OPERATOR

SQL Comparison SQL LOGICAL Operator SQL Cast Operator SQL Arithmetic

Difference

SQL vs NOSQL WHERE vs HAVING DELETE vs DROP GROUP BY vs ORDER BY DROP vs TRUNCATE SQL IN vs SQL EXISTS Difference between Delete, Drop and Truncate in SQL

MISC

SQL SubQuery SQL CASE Commit and Rollback in SQL Pattern Matching in SQL DDL Commands in SQL DML Commands in SQL Types of SQL Commands SQL COUNT SQL Primary Key SQL FOREIGN KEY SET Operators in SQL Check Constraint in SQL SQL EXCEPT SQL VIEW SQL WHERE Statement SQL CRUD Operation Where Condition in SQL TCL Commands in SQL Types of SQL JOINS SQL Nth Highest Salary SQL NOT OPERATOR SQL UNION ALL SQL INTERSECT SQL Data Definition Language SQL Data Manipulation Language SQL Data Control Language SQL CONSTRAINTS SQL Aggregate Operators SQL KEYS Codd’s Rules in SQL What is SQL Injection? Trigger In SQL SQL WHERE Multiple Conditions Truncate function in SQL SQL Formatter WEB SQL SQL Auto Increment Save Point in SQL space() function in SQL SQL Aggregate Functions SQL Topological Sorting SQL Injection SQL Cloning Tables SQL Aliases SQL Handling Duplicate Update Query in SQL Grant Command in SQL SQL SET Keyword SQL Order BY LIMIT SQL Order BY RANDOM

How To

How to use the BETWEEN operator in SQL How To Use INNER JOIN In SQL How to use LIKE in SQL How to use HAVING Clause in SQL How to use GROUP BY Clause in SQL How To Remove Duplicates In SQL How To Delete A Row In SQL How to add column in table in SQL ? How to drop a column in SQL? How to create a database in SQL? How to use COUNT in SQL? How to Create Temporary Table in SQL? How to Add Foreign Key in SQL? How to Add Comments in SQL? How To Use Group By Clause In SQL How To Use Having Clause In SQL How To Delete Column In Table How To Compare Date In SQL How index works in SQL How to calculate age from Date of Birth in SQL How to Rename Column name in SQL What are single row and multiple row subqueries?

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
0Foundation Rule
1Information Rule
2Guaranteed Access Rule
3Systematic Treatment of NULL Values
4Active Online Catalog
5Comprehensive Data SubLanguage Rule
6View Updating Rule
7High-level Insert, Update, Delete Rule
8Physical Data Independence Rule
9Logical Data Independence Rule
10Integrity Independence
11Distribution Independence
12Non-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).