Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

12 Codd S Rules in SQL

12 Codd S Rules in SQL

Dr. E. F. Codd proposed 12 rules (numbered from 0 to 12) to define what is required from a Database Management System (DBMS) to be considered relational — meaning it should manage data using relational algebra and support full relational capabilities.

These rules are conceptual and serve as a guideline for evaluating relational database systems like MySQL, PostgreSQL, Oracle, SQL Server, etc.


? Codd's 12 Rules in SQL (Relational Database Management Systems)

Rule 0: Foundation Rule

A system must qualify as a relational database system and use its relational capabilities to manage the database.


Rule 1: Information Rule

All data should be represented logically in tables (relations), and the data should be stored in cells at the intersection of rows and columns.

? Everything (data, metadata) should be stored in table format.


Rule 2: Guaranteed Access Rule

Every data item (atomic value) should be accessible by a combination of table name, primary key (row), and column name.

? No hidden pointers or location-based access.


Rule 3: Systematic Treatment of Null Values

Null values must be uniformly handled as representing missing, inapplicable, or unknown information.

? Null ? 0 or empty string; and should be treated consistently.


Rule 4: Dynamic Online Catalog Based on the Relational Model

The database should store its structure (metadata) using the same relational format as normal data, and users should be able to query this catalog using SQL.

? Example: Accessing information_schema in MySQL/PostgreSQL.


Rule 5: Comprehensive Data Sub-language Rule

The system must support at least one language that:

  • Can define data (DDL)

  • Manipulate data (DML)

  • Define constraints

  • Handle transactions and views

? SQL is the language used in modern RDBMS.


Rule 6: View Updating Rule

All theoretically updatable views should be updatable through the system.

? Not all views in practice are updatable; depends on DBMS.


Rule 7: High-Level Insert, Update, and Delete

The system must support set-level (not just row-by-row) operations.

? You should be able to update/delete multiple rows at once.


Rule 8: Physical Data Independence

Changes in physical storage (e.g., how data is stored on disk) should not affect how you access the data.

? SQL queries should work even if the internal structure is optimized.


Rule 9: Logical Data Independence

Changes in logical schema (tables, columns) should not affect applications, as long as the changes do not alter the data semantics.

? Hard to fully implement; even modern RDBMS struggle here.


Rule 10: Integrity Independence

Integrity constraints (like NOT NULL, FOREIGN KEY, etc.) should be stored in the catalog and not in the application code.

? Should be enforced by the DBMS itself.


Rule 11: Distribution Independence

The system should function regardless of whether data is distributed across multiple locations.

? Users should not need to know where the data resides physically.


Rule 12: Non-subversion Rule

If the system provides low-level access (e.g., file-level), it should not bypass integrity rules and constraints.

? Access through all levels must enforce all data rules.


? Summary Table

Rule No.Rule NameDescription
0Foundation RuleMust be a relational system
1Information RuleData stored in tables
2Guaranteed AccessAccess by table, primary key, column
3Null HandlingConsistent treatment of nulls
4Active CatalogMetadata in relational form
5Comprehensive LanguageSupport full SQL features
6View UpdatingViews should be updatable
7Set-Level OperationsSupport multi-row ops
8Physical Data IndependenceNo effect of physical changes
9Logical Data IndependenceNo effect of schema changes
10Integrity IndependenceConstraints in DB, not code
11Distribution IndependenceNo user concern of data location
12Non-subversionAll access obeys DB rules

Let me know if you want a printable version or quiz-style explanation for learning!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql