Tap to Read ➤

Introduction To Relational Data Model

Nilesh Parekh
Relational Data Model is considered as one of the most beautifully devised data management models used in the storage, retrieval, and maintenance of data. This story provides some information about it.
Today, almost 75-85% applications that are developed, deal with some type of data and database. Every other second, huge amounts of data is gathered over the Internet and through various devices all over the world. It helps companies in keeping track of their business processes, manage information effectively, and in turn help them grow.
It is almost impossible to go on storing huge amounts of information without managing it in a proper way. For that, the information is stored in the database. There are various methods and models that are developed for this purpose. One such model is Relational Database Model, which has proved to be the best.
As a simple explanation, this model allows various data packets/files to be related to each other with a set of relations. For example, if customer names are stored in a file 'CUSTOMER', and another file named 'CITIES' contains the names of cities, then, CUSTOMER file can have a relation with CITY, which will help identify the city a customer belongs to.
Devised by Edgar F. Codd, the relational data model is entirely based on the predicate logic and set theory of mathematics. Codd used mathematical 'n' relations as a base to represent the data, which is a subset of the Cartesian product of n sets.
These sets are bound to each other in a structured manner with various constraints (i.e., relations). It is managed by using relational calculus and various constraints to form a container that holds it (which is also known as a schema), and the relation between them can be expressed in a particular structured language.
Information is arranged in a relation which is visually represented in a two dimensional table. It is inserted into the table in the form of tuples (which are nothing but rows).
A tuple is formed by one or more than one attributes, which are used as basic building blocks in the formation of various expressions used to derive meaningful information. There can be any number of tuples in the table, but all of them contain fixed and same attributes with varying values.
The relational model is implemented in database, where a relation is represented by a table, a tuple by a row, and an attribute by a column. An attribute name is the name of the column such as 'identifier', 'name', 'city', etc. Attribute value contains the value for column in the row, constraints are applied to the table and form a logical schema.
In order to facilitate the selection of a particular row/tuple from the table, the attributes, i.e., column names are used. To expedite the selection of the rows, some fields are defined uniquely to use them as indexes. This helps in searching the required data as fast as possible.
All the algebra operations such as Select, Intersection, Product, Union, Difference, Project, Join, Division, Merge, etc., can also be performed. Operations on this Model are facilitated with the help of different conditional expressions, various key attributes, pre-defined constraints, etc.
For example: selection of information of a customer living in some city for more than 20 years. Here are a few commonly used terms.

Candidate Key

Any field or a combination of fields that identifies a record uniquely is called a candidate key. It cannot contain NULL values and should always contain a unique value.

Primary Key

Primary key is nothing but a candidate key that identifies a record uniquely.

Foreign Key

A foreign key is a primary key for other table, in which it uniquely identifies a record. It defines relation between two (or more) tables. A foreign key can contain NULL values.

Constraints

Constraints are logic rules that are used to ensure consistency or avoid certain unacceptable operations on the data.