What are the three 3 components of a relational data model explain each component?

RDBMS stands for relational database management system. A relational model can be represented as a table of rows and columns. A relational database has following major components:1. Table2. Record or Tuple3. Field or Column name or Attribute4. Domain5. Instance6. Schema

7. Keys

1. Table

A table is a collection of data represented in rows and columns. Each table has a name in database. For example, the following table “STUDENT” stores the information of students in database.

Table: STUDENT

Student_IdStudent_NameStudent_AddrStudent_Age
101ChaitanyaDayal Bagh, Agra27
102AjeetDelhi26
103RahulGurgaon24
104ShubhamChennai25

2. Record or Tuple

Each row of a table is known as record. It is also known as tuple. For example, the following row is a record that we have taken from the above table.

3. Field or Column name or Attribute

The above table “STUDENT” has four fields (or attributes): Student_Id, Student_Name, Student_Addr & Student_Age.

4. Domain

A domain is a set of permitted values for an attribute in table. For example, a domain of month-of-year can accept January, February,…December as values, a domain of dates can accept all possible valid dates etc. We specify domain of attribute while creating a table.

An attribute cannot accept values that are outside of their domains. For example, In the above table “STUDENT”, the Student_Id field has integer domain so that field cannot accept values that are not integers for example, Student_Id cannot has values like, “First”, 10.11 etc.

5. Instance and Schema

I have already covered instance and schema in a separate guide, you can refer the guide here.

6. Keys

This is our next topic, I have covered the keys in detail in separate tutorials. You can refer the keys index here.


Relational data model is the primary data model, which is used widely around the world for data storage and processing. This model is simple and it has all the properties and capabilities required to process data with storage efficiency.

Concepts

Tables − In relational data model, relations are saved in the format of Tables. This format stores the relation among entities. A table has rows and columns, where rows represents records and columns represent the attributes.

Tuple − A single row of a table, which contains a single record for that relation is called a tuple.

Relation instance − A finite set of tuples in the relational database system represents relation instance. Relation instances do not have duplicate tuples.

Relation schema − A relation schema describes the relation name (table name), attributes, and their names.

Relation key − Each row has one or more attributes, known as relation key, which can identify the row in the relation (table) uniquely.

Attribute domain − Every attribute has some pre-defined value scope, known as attribute domain.

Constraints

Every relation has some conditions that must hold for it to be a valid relation. These conditions are called Relational Integrity Constraints. There are three main integrity constraints −

  • Key constraints
  • Domain constraints
  • Referential integrity constraints

Key Constraints

There must be at least one minimal subset of attributes in the relation, which can identify a tuple uniquely. This minimal subset of attributes is called key for that relation. If there are more than one such minimal subsets, these are called candidate keys.

Key constraints force that −

  • in a relation with a key attribute, no two tuples can have identical values for key attributes.

  • a key attribute can not have NULL values.

Key constraints are also referred to as Entity Constraints.

Domain Constraints

Attributes have specific values in real-world scenario. For example, age can only be a positive integer. The same constraints have been tried to employ on the attributes of a relation. Every attribute is bound to have a specific range of values. For example, age cannot be less than zero and telephone numbers cannot contain a digit outside 0-9.

Referential integrity Constraints

Referential integrity constraints work on the concept of Foreign Keys. A foreign key is a key attribute of a relation that can be referred in other relation.

Referential integrity constraint states that if a relation refers to a key attribute of a different or same relation, then that key element must exist.

A relational database management system compromises various component. Tables, records, attributes, instances, schemas and keys together form a relational database.

In this page, we will discuss each component of RDBMS in detail.

Table

It is the primary component of RDMS. A relational database may constitute one or more tables related together. It is a combination of rows and columns where rows represent different entries in the database and column represents the features or attributes of those entries. Each table has a unique name in RDBMS and a primary key to uniquely identify the entry. These entries are also called entities of the table.

Records

Each row of the table is a record of the single entity. This contains all the information about the entity and all its corresponding values to all the attributes of the particular entity. Each record in the table is called a tuple. For example: If we have an employee table with records of five employees, then each horizontal row with all detail of the particular employee is a Record.

Field or Column Name

Each column of a table represents a unique attribute of the entity. No two column names can be the same. They describe various attributes and features of the entity. For example: In the employee table there can be various attributes like employee name, employee_id and various other details.

Domain

It is a constraint on the entry of the value in the field of the table. It describes the set of values that can be accepted as valid inputs in the particular column. For example: In the Employee_phone_number this field will only accept a ten-digit integer number. The domain for various attributes can be specified by the user while creating the table. Any value that lies outside this set of values will not be accepted and an error will be thrown when such value is entered.

Schema and Instance

Schema: It describes the structure of the database at various levels. There are three layers of schema that separates the physical, logical and application part of the database. Schema determines the design of the database. Physical Schema, Logical Schema and the External Schema are mapped together. They interact with each other to perform the operations on the database. A schema represents all the entities of the database and the relationship between those entities.

1. Internal Level

The internal level of schema determines the definition of the database. It defines the physical structure of the database. It defines the format in which the data will be stored or say the structure in which the data will be stored. It is also known as the Physical Schema. It describes the complex data structures of the database. The user does not have the access to this level, only the data administrator can alter any change into it.

2. Conceptual Level

At this level, we describe the design of the database. This is called the logical schema; the end-user does not have access to this layer. The programmers and database administrators are the only ones with access to this level. At this level, we store the data in the data structures described at the physical level. Though the details of the implementation of the physical level are kept hidden at this level. It describes what data will be stored in the database.

3. External Level

It describes the various views of the database. This level is also called the view level. There can be different views for different users depending on the needs of the end-users. At this level, the end-user interacts with the database and the details of both physical and logical schemas are kept hidden from the user.

The hiding of details of one level from other and only showing the necessary information is called abstraction.

Instance: An instance is the view of the data stored in the database at a particular time. It is a snapshot of the database at that particular time. It is the moment at which we declare all the attributes of the table in the database and the data type variable that will be stored in the particular column. The instance of the database changes continuously whenever any updating is performed on the database.

Key

There are various types of keys in a database. Let us discuss each type one by one.

Primary Key – Each table should at least have a primary key, this key can uniquely identify each record of that table.

Super Key – A super key is a combination of multiple columns to uniquely identify a record of the table.

Candidate Key – Any key in the table is also a candidate key of that table.

Alternate Key– Every key except the primary key of the table is an alternate key. 

Composite Key– When we cannot uniquely identify each record with a single column entry, we combine multiple columns and assign the combination as the primary key.

Foreign Key – It refers to the primary key of the other table. They act as a way to refer to the entry of another table.