The Wayback Machine - https://web.archive.org/web/20240917110728/https://www.geeksforgeeks.org/introduction-of-relational-model-and-codd-rules-in-dbms/
Open In App

Introduction of Relational Model and Codd Rules in DBMS

Last Updated : 03 Aug, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Pre-Requisite: Relational Model in DBMS

It was proposed by Dr. E.F. Codd. It uses the concept of relations to represent each and every file. Relations are Two-Dimensional Tables. It is easy to implement and easy to simplification in the operations to manipulate the data. This is the most popular data model. It is simple to implement. It uses the primary key and secondary key to connect any two files. Normalization Theory is used to design the object-based data model. Relational Algebra and Relational Calculus are used to process the relations manually. Many database languages are oriented toward handling relational data models. A Relational Database Model consists of relations to connect them by key fields. A relation has some attributes. The relation is represented in rows and columns. Each column of the relation is called an attribute. Each row in the relation is called a tuple. Each relation can have one unique column i.e. primary key. Each relation can have n-columns and n-tuple. Each relation is preceded by the name of that relation. The fields of the relations are separated by commas and placed within the parentheses of the relation. The relational model represents data in the form of relations or tables.

Example: Relational Model can be represented as shown below

STUDENT (StudNo, Sname, Special)
ENROLLMENT (StudNo, Subcode, marks)
SUBJECT (Subcode, Subname, Maxmarks, Faccode)
FACULTY (Faccode, Fname, Dept)

 Terminologies 

Relational Schema: Schema represents the structure of a relation.                                                                                                         

Example: Relational Schema of STUDENT relation can be represented as STUDENT(STUD_NO, STUD_NAME,  STUD_PHONE, STUD_STATE, STUD_COUNTRY, STUD_AGE).

Relational Instance: The set of values present in a relationship at a particular instance of time is known as a relational instance as shown in Table 1 and Table 2. 

Attribute: Each relation is defined in terms of some properties, each of which is known as an attribute.  

Example: STUD_NO, STUD_NAME, etc. are attributes of relation STUDENT. 

The domain of an attribute: The possible values an attribute can take in a relation is called its domain. 

Example: domain of STUD_AGE can be from 18 to 40. 

Tuple: Each row of a relation is known as a tuple.                                                                                                                                      

Example: STUDENT relation given below has 4 tuples. 

NULL values: Values of some attribute for some tuples may be unknown, missing, or undefined which are represented by NULL. Two NULL values in a relationship are considered different from each other. Table 1 and Table 2 represent the relational model having two relations STUDENT and STUDENT_COURSE. 

STUDENT TABLE

STUD_NO STUD_NAME STUD_PHONE STUD_STATE STUD_COUNTRY STUD_AGE
1 RAM 9716271721 Haryana India 20
2 RAM 9898291281 Punjab India 19
3 SUJIT 7898291981 Rajasthan India 18
4 SURESH 9985286317 Punjab India 21

STUDENT COURSE TABLE

STUD_NO                       COURSE_NO                   COURSE_NAME                     
1 C1 DBMS
2 C2 Computer Networks
1 C2 Computer Networks

RDBMS Vendors

There are several vendors that offer Relational Database Management Systems (RDBMS). Here are some of the most popular ones:

Oracle: Oracle Database is one of the most widely used RDBMS products in the market. It is known for its robustness, scalability, and reliability. It is used by many large enterprises and is particularly well-suited for data warehousing and transaction processing.

Microsoft: Microsoft SQL Server is a popular RDBMS used in Windows environments. It offers a range of features, including data mining, business intelligence, and reporting services.

IBM: IBM DB2 is a popular RDBMS used in enterprise environments. It offers high availability, disaster recovery, and scalability features.

MySQL: MySQL is an open-source RDBMS used by many small to medium-sized businesses. It is known for its ease of use, flexibility, and low cost.

PostgreSQL: PostgreSQL is another popular open-source RDBMS. It is known for its scalability, reliability, and support for complex transactions.

SAP: SAP HANA is an in-memory RDBMS that is designed for high-performance analytics and data processing. It is often used in enterprise environments for real-time reporting and business intelligence.

Relational Algebra

It is a procedural Language. It consists of a set of operators that can be performed on relations. Relational Algebra forms the basis for many other high-level data sub-languages like SQL and QBE. 
 Relational algebra has mainly 9 types of operators.

1. UNION (U): A and B are two relations. It displays total values (Attributes) in both relations. It avoids duplicate values in both relations. U symbol can be used.
 

Syntax: 

A UNION B (or) A U B
 

Example:

 A = { clerk, manager, salesman}
B = { president, clerk, manager}
A UNION B = {clerk, manager, salesman, president}

2. INTERSECTION (∩): A and B are two relations. It displays common elements in both relations. “∩” symbol can be used.
 

Syntax: 

A INTERSECT B (or) A ∩ B

Example: 

A = { clerk, manager, salesman}
B = { president, clerk, manager}
A INTERSECT B = { clerk, manager}

3. DIFFERENCE (─): A and B are two relations. It displays elements in relation A not in relation B. 
 

Syntax: 

A MINUS B (OR) A ─ B

Example:

A = { clerk, manager, salesman}
B = { president, clerk, manager}
A MINUS B = {salesman}

4. CARTESIAN PRODUCT(X): A and B are two relations. It has a new relation consisting of all pair wises combinations of all elements in A and B. The relation A has “m” elements and relation B has “n” elements, then the resultant relation will be “ m * n “. 
 

Syntax: 

A TIMES B (OR) A X B

Example: 

A = { clerk, manager, salesman}
B = { president, clerk, manager}
A TIMES B = { (clerk, president),
(clerk, clerk),(clerk, manager),
(manager, president), (manager, clerk),
(manager, manager),(salesman, president), 
(salesman, clerk), (salesman, manager) }

5. SELECTION (σ): It displays all the attributes or columns of all the rows in a relation. “” operator can be used to select the attributes in a relation.

The  select operation 

In general SELECT operation is denoted by

(σ)(R)

(σ)(Sigma): SELECT operator

 θ: Selection condition

R: Relation or relational algebra expression.

In general the select condition is a Boolean condition (i.e. an expression using logical connective) of terms that have the form attribute OP constant 1 OP attribute2 where OP is the comparison operators <,>,=,>= etc.
Syntax: 

σ condition (relation name) 

6. PROJECTION (π): It displays some specified columns in a relation. “π” operator can be used to select some specified columns in a relation. It selects tuples that satisfy the given predicate from a relation. It displays some specified columns by using some conditions.

Syntax:

Syntax: π(col1,col2…) Relation Name

Example: 

π(sno, sname, total) MARKS

7. JOIN( ): It combines two or more relations. Symbols can be used. It can be mainly divided into mainly 4 types. These are mainly

8. DIVIDE (÷): It divides the tuple from one relation to another relation
 

Syntax: 

A DIVIDE B (OR) A ÷ B

Example: 

A = { clerk, manager, salesman} 
B = { clerk, manager}
A DIVIDE B = {salesman}

9. RENAME(ρ): It gives another name to the relation.
 

Syntax: 

ρ(OLD RELATION, NEW RELATION)

Example: 

ρ(STUDENT, MARKS)
It changes the “student” relation to “Marks” relation.
It also renames the specified column.
It changes the old-column name to new-column name.

Features of the relational model and Codd’s Rules :

Tables/Relations: The basic building block of the relational model is the table or relation, which represents a collection of related data. Each table consists of columns, also known as attributes or fields, and rows, also known as tuples or records.

Primary Keys: In the relational model, each row in a table must have a unique identifier, which is known as the primary key. This ensures that each row is unique and can be accessed and manipulated easily.

Foreign Keys: Foreign keys are used to link tables together and enforce referential integrity. They ensure that data in one table is consistent with data in another table.

Normalization: The process of organizing data into tables and eliminating redundancy is known as normalization. Normalization is important in the relational model because it helps to ensure that data is consistent and easy to maintain.

Codd’s Rules: Codd’s Rules are a set of 12 rules that define the characteristics of a true relational DBMS. These rules ensure that the DBMS is consistent, reliable, and easy to use.

Atomicity, Consistency, Isolation, Durability (ACID): The ACID properties are a set of properties that ensure that transactions are processed reliably in the relational model. Transactions are sets of operations that are executed as a single unit, ensuring that data is consistent and accurate.

Advantages of Relational Algebra

Relational Algebra is a formal language used to specify queries to retrieve data from a relational database. It has several advantages that make it a popular choice for managing and manipulating data. Here are some of the advantages of Relational Algebra:

Simplicity: Relational Algebra provides a simple and easy-to-understand set of operators that can be used to manipulate data. It is based on a set of mathematical concepts and principles, which makes it easy to learn and use.

Formality: Relational Algebra is a formal language that provides a standardized and rigorous way of expressing queries. This makes it easier to write and debug queries, and also ensures that queries are correct and consistent.

Abstraction: Relational Algebra provides a high-level abstraction of the underlying database structure, which makes it easier to work with large and complex databases. It allows users to focus on the logical structure of the data, rather than the physical storage details.

Portability: Relational Algebra is independent of any specific database management system, which means that queries can be easily ported to other systems. This makes it easy to switch between different databases or vendors without having to rewrite queries.

Efficiency: Relational Algebra is optimized for efficiency and performance, which means that queries can be executed quickly and with minimal resources. This is particularly important for large and complex databases, where performance is critical.

Extensibility: Relational Algebra provides a flexible and extensible framework that can be extended with new operators and functions. This allows developers to customize and extend the language to meet their specific needs.

Disadvantages of Relational Algebra

While Relational Algebra has many advantages, it also has some limitations and disadvantages that should be considered when using it. Here are some of the disadvantages of Relational Algebra:

Complexity: Although Relational Algebra is based on mathematical principles, it can be complex and difficult to understand for non-experts. The syntax and semantics of the language can be challenging, and it may require significant training and experience to use it effectively.

Limited Expressiveness: Relational Algebra has a limited set of operators, which can make it difficult to express certain types of queries. It may be necessary to use more advanced techniques, such as subqueries or joins, to express complex queries.

Lack of Flexibility: Relational Algebra is designed for use with relational databases, which means that it may not be well-suited for other types of data storage or management systems. This can limit its flexibility and applicability in certain contexts.

Performance Limitations: While Relational Algebra is optimized for efficiency and performance, it may not be able to handle large or complex datasets. Queries can become slow and resource-intensive when dealing with large amounts of data or complex queries.

Limited Data Types: Relational Algebra is designed for use with simple data types, such as integers, strings, and dates. It may not be well-suited for more complex data types, such as multimedia files or spatial data.

Lack of Integration: Relational Algebra is often used in conjunction with other programming languages and tools, which can create integration challenges. It may require additional programming effort to integrate Relational Algebra with other systems and tools.

Relational Algebra is a powerful and useful tool for managing and manipulating data in relational databases, it has some limitations and disadvantages that should be carefully considered when using it.

Codd’s Twelve Rules of Relational Database

Codd rules were proposed by E.F. Codd which should be satisfied by the relational model. Codd’s Rules are basically used to check whether DBMS has the quality to become Relational Database Management System (RDBMS). But, it is rare to find that any product has fulfilled all the rules of Codd. They generally follow the 8-9 rules of Codd. E.F. Codd has proposed 13 rules which are popularly known as Codd’s 12 rules. These rules are stated as follows:

  • Rule 0: Foundation Rule– For any system that is advertised as, or claimed to be, a relational database management system, that system must be able to manage databases entirely through its relational capabilities.
  • Rule 1: Information Rule– Data stored in the Relational model must be a value of some cell of a table.
  • Rule 2: Guaranteed Access Rule– Every data element must be accessible by the table name, its primary key, and the name of the attribute whose value is to be determined.
  • Rule 3: Systematic Treatment of NULL values– NULL value in the database must only correspond to missing, unknown, or not applicable values.
  • Rule 4: Active Online Catalog– The structure of the database must be stored in an online catalog that can be queried by authorized users.
  • Rule 5: Comprehensive Data Sub-language Rule- A database should be accessible by a language supported for definition, manipulation, and transaction management operation.
  • Rule 6: View Updating Rule- Different views created for various purposes should be automatically updatable by the system.
  • Rule 7: High-level insert, update and delete rule- Relational Model should support insert, delete, update, etc. operations at each level of relations. Also, set operations like Union, Intersection, and minus should be supported.
  • Rule 8: Physical data independence- Any modification in the physical location of a table should not enforce modification at the application level.
  • Rule 9: Logical data independence- Any modification in the logical or conceptual schema of a table should not enforce modification at the application level. For example, merging two tables into one should not affect the application accessing it which is difficult to achieve.
  • Rule 10: Integrity Independence- Integrity constraints modified at the database level should not enforce modification at the application level.
  • Rule 11: Distribution Independence- Distribution of data over various locations should not be visible to end-users.
  • Rule 12: Non-Subversion Rule- Low-level access to data should not be able to bypass the integrity rule to change data.

GATE Question

Given the basic ER and relational models, which of the following is INCORRECT?  [GATE CS 2012] 

  1. An attribute of an entity can have more than one value.
  2. An attribute of an entity can be a composite.
  3. In a row of a relational table, an attribute can have more than one value. 
  4. In a row of a relational table, an attribute can have exactly one value or a NULL value. 

Answer: In the relation model, an attribute can’t have more than one value. So, option 3 is the answer.



Previous Article
Next Article

Similar Reads

Codd's Rules in DBMS
Codd's rules are proposed by a computer scientist named Dr. Edgar F. Codd and he also invent the relational model for database management. These rules are made to ensure data integrity, consistency, and usability. This set of rules basically signifies the characteristics and requirements of a relational database management system (RDBMS). In this a
3 min read
Difference between E-R Model and Relational Model in DBMS
In database management systems (DBMS), two key methods are the Relational model and the Entity-Relationship (E-R) model. Each has a specific function in the development and operation of databases. While the Relational model provides the practical structure for organizing and managing data in relational databases, the E-R model concentrates on offer
3 min read
Relational Model in DBMS
E.F. Codd proposed the relational Model to model data in the form of relations or tables. After designing the conceptual model of the Database using ER diagram, we need to convert the conceptual model into a relational model which can be implemented using any RDBMS language like Oracle SQL, MySQL, etc. So we will see what the Relational Model is. T
7 min read
Difference between Relational model and Document Model
The relational model organizes data into tables with rows and columns, ideal for structured data. On the other hand, the document model stores data in hierarchical documents, which offers more flexibility for managing unstructured or semi-structured data. Both models serve different purposes in database management. What is the Relational Model?The
3 min read
Mapping from ER Model to Relational Model
To understand this, you should have an idea about: ER model Relation model After designing the ER diagram of system, we need to convert it to Relational models which can directly be implemented by any RDBMS like Oracle, MySQL etc. In this article we will discuss how to convert ER diagram to Relational Model for different scenarios. Case 1: Binary R
5 min read
Difference between Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC)
1. Tuple Relational Calculus (TRC) : A tuple relational calculus is a non-procedural query language that specifies to select of the tuples in a relation. It can select the tuples with a range of values or tuples for certain attribute values etc. The resulting relation can have one or more tuples. Notation : {T | P (T)} or {T | Condition (T)} where
3 min read
Difference between Relational Algebra and Relational Calculus
Relational Algebra and Relational Calculus are two preliminarily important topics in the study of DBMS. Both are standardized query languages used for querying databases but the two have different approaches and operations. Relational Algebra is imperative as it deals mainly with how the data is to be obtained whereas Relational Calculus is imperat
6 min read
OLAP Guidelines (Codd's Rule)
On-line Analytical Processing (OLAP) is a category of software technology that enables analytics, managers and executives to gain insight into data through fast, consistent, interactive access in a wide variety of information that has been transformed from the raw data to reflect the real dimensionality of the enterprise as understood by the user.
2 min read
Boyce-Codd Normal Form (BCNF)
Pre-Requisite: First Normal Form, Second Normal Form, Third Normal Form Application of the general definitions of 2NF and 3NF may identify additional redundancy caused by dependencies that violate one or more candidate keys. However, despite these additional constraints, dependencies can still exist that will cause redundancy to be present in 3NF r
6 min read
Introduction of Relational Algebra in DBMS
Pre-Requisite: Relational Model in DBMS Relational Algebra is a procedural query language. Relational algebra mainly provides a theoretical foundation for relational databases and SQL. The main purpose of using Relational Algebra is to define operators that transform one or more input relations into an output relation. Given that these operators ac
4 min read
Tuple Relational Calculus (TRC) in DBMS
Tuple Relational Calculus (TRC) is a non-procedural query language used in relational database management systems (RDBMS) to retrieve data from tables. TRC is based on the concept of tuples, which are ordered sets of attribute values that represent a single row or record in a database table. TRC is a declarative language, meaning that it specifies
4 min read
Relational Query Language in DBMS
SQL has its own querying methods to interact with the database. But how do these queries work in the database? These queries work similarly to Relational Algebra that we study in mathematics. In the database, we have tables participating in relational Algebra. Relational Database systems are expected to be equipped with a query language that assist
4 min read
What is Object-Relational Mapping (ORM) in DBMS?
Object-relational mapping (ORM) is a key concept in the field of Database Management Systems (DBMS), addressing the bridge between the object-oriented programming approach and relational databases. ORM is critical in data interaction simplification, code optimization, and smooth blending of applications and databases. The purpose of this article is
7 min read
Domain Relational Calculus in DBMS
Domain Relational Calculus is a non-procedural query language equivalent in power to Tuple Relational Calculus. Domain Relational Calculus provides only the description of the query but it does not provide the methods to solve it. In Domain Relational Calculus, a query is expressed as, { &lt; x1, x2, x3, ..., xn &gt; | P (x1, x2, x3, ..., xn ) } wh
2 min read
Difference between Hierarchical and Relational data model
1. Hierarchical Data Model : Hierarchical data model is the oldest type of data model. It was developed by IBM in 1968. It organizes data in a tree-like structure. Hierarchical model consists of the following : It contains nodes that are connected by branches. Topmost node is called the root node. If there are multiple nodes that appear at the top
3 min read
Types of Keys in Relational Model (Candidate, Super, Primary, Alternate and Foreign)
Keys are one of the basic requirements of a relational database model. It is widely used to identify the tuples(rows) uniquely in the table. We also use keys to set up relations amongst various columns and tables of a relational database. Different Types of Database Keys Candidate Key Primary Key Super Key Alternate Key Foreign Key Composite Key To
6 min read
Difference Between Hierarchical, Network and Relational Data Model
In order to define the connections, organization, and structure of data in a database management system (DBMS), data models are essential. The effectiveness of a database's ability to store, retrieve, and alter data is greatly influenced by the choice of data model. The Hierarchical, Network, and Relational models are some of the oldest types of da
6 min read
Difference between Network and Relational data model
Data models specify the organization, archiving, and manipulation of data in database management systems (DBMSs). The Network Data Model and the Relational Data Model are two popular forms of data models. Each of these models has distinct characteristics, benefits, and uses for organizing and managing data in a variety of ways. To assist you in com
5 min read
Constraints on Relational Database Model
In modeling the design of the relational database we can put some restrictions like what values are allowed to be inserted in the relation, and what kind of modifications and deletions are allowed in the relation. These are the restrictions we impose on the relational database. In models like Entity-Relationship models, we did not have such feature
6 min read
Anomalies in Relational Model
Anomalies in the relational model refer to inconsistencies or errors that can arise when working with relational databases, specifically in the context of data insertion, deletion, and modification. There are different types of anomalies that can occur in referencing and referenced relations which can be discussed as: These anomalies can be categor
5 min read
Various rules of Object Oriented DBMS
From the past few years, data management and application environment have been getting complex. These can be handled by the Object Oriented Database Management System (ODBMS). In this system, there are combined features of object-oriented and database management system. Figure - Object Oriented DBMS Object-Oriented features such as Encapsulation, P
4 min read
Integrity Rules in DBMS
In DBMS systems, integrity rules, which take a prime place, are designed to ensure that the quality of data is always high, with no inconsistencies or errors. The set of principles, also known as the integrity rules or constraints, helps to manage the data stored in the system in the right way and determine whether it’s suitable for certain purpose
5 min read
Inference Rules in DBMS
Inference rules in databases are also known as Armstrong’s Axioms in Functional Dependency. These rules govern the functional dependencies in a relational database. From inference rules a new functional dependency can be derived using other FDs. These rules were introduced by William W. Armstrong. In this article, we will come to know about all the
3 min read
Hierarchical Model in DBMS
Hierarchical Model :This is one of the oldest models in a data model which was developed by IBM, in the 1950s. In a hierarchical model, data are viewed as a collection of tables, or we can say segments that form a hierarchical relation. In this, the data is organized into a tree-like structure where each record consists of one parent record and man
4 min read
What is XML Data Model in DBMS?
The database management system market is filled with many choices, and XML is a strong contender due to the elegant syntax model it uses to organize and structure data. The text would give you information on the main parts of the Data Model for XML, thus, you would be able to understand the essential terms and why they are important in databases. T
6 min read
Network Model in DBMS
The Network Model in a Database Management System (DBMS) is a data model that allows the representation of many-to-many relationships in a more flexible and complex structure compared to the Hierarchical Model. It uses a graph structure consisting of nodes (entities) and edges (relationships) to organize data, enabling more efficient and direct acc
6 min read
Difference between Bottom-Up Model and Top-Down Model
Top-Down Design Model: In the top-down model, an overview of the system is formulated without going into detail for any part of it. Each part of it then refined into more details, defining it in yet more details until the entire specification is detailed enough to validate the model. if we glance at a haul as a full, it's going to appear not possib
3 min read
Introduction to TimeStamp and Deadlock Prevention Schemes in DBMS
Deadlock occurs when each transaction T in a schedule of two or more transactions waiting for some item locked by some other transaction T' in the set. Thus, both end up in a deadlock situation, waiting for the other to release the lock on the item. Deadlocks are a common problem and we have introduced the problem while solving the Concurrency Cont
7 min read
ACID Model vs BASE Model For Database
The difference between ACID and BASE database models is the way they deal with this limitation. The ACID model provides a consistent system.The BASE model provides high availability.To provide further insight, we will discuss each of the models separately in detail. ACID Model:Collections of operations that form a single logical unit of work are ca
5 min read
Difference between Relational database and NoSQL
1. Relational Database : RDBMS stands for Relational Database Management Systems. It is most popular database. In it, data is store in the form of row that is in the form of tuple. It contain numbers of table and data can be easily accessed because data is store in the table. This Model was proposed by E.F. Codd. 2. NoSQL : NoSQL Database stands fo
2 min read
Article Tags :