Relation in DBMS with Example

Relation

A relational database uses tables, records, and columns to gather many kinds of data sets. In order to facilitate the storage of relational databases, it is utilized to establish a clear relationship between database tables. Relational databases like Microsoft SQL Server, Oracle Database, MySQL, and others are examples.

Relation in DBMS with Example

Types of Relation in DBMS

1. One-to-One
2. One-to-Many
3. Many-to-Many

1. One-to-One

One row of data in one table is only related to one row of data in another table; these are known as one-to-one relationships. The relationship between a person and their passport is an actual example of a one-to-one relationship. 

Since each person will only have one passport, there will be two tables: one for a list of people and another for a list of their passports.


2. One-to-Many

When one row of data in one table is connected to many (one or more) rows of data in another table, this is known as a one-to-many relationship. The class-student relationship is a real-world example of a one-to-many relationship.

One student will enroll in multiple classes at college. Therefore, a table that lists a group of classes will be coupled to another database that provides a list of students.


3. Many-to-Many

When multiple rows of data in one table are connected to multiple rows of data in another table, this is known as a many-to-many relationship. 

A table containing a list of several university courses and a table containing a list of multiple student details is a real-world illustration of a many-to-many relationship. A student may enroll in more than one course, and a course may have a large number of attendant students.

Characteristics of Relations in DBMS  

1. Ordering of  tuples in a Relation

A collection of tuples is called a relation. Since there is no mathematical order among the members of a set, there is no specific order among the tuples in a relation. To put it another way, a relation is not affected by the tuple ordering.

2. Ordering of tuples within a tuple

It is essential to arrange the values in a tuple as well as the attributes in a relation in a relation schema as, as indicated in the previous definition of a relation, an n-tuple is an ordered list of n-values.At a higher level of abstraction, however, as long as the ordering between attributes and values is upheld, the sequence of attributes and their values is irrelevant.


3. Values and Nulls in the tuples

According to the basic relational model, every value in a tuple is an atomic value, meaning it cannot be broken down into its component parts. Composite and multivalued properties are therefore prohibited. The flat-relational model is another name for this model. 

The idea of NULL values, which are used to represent the values of attributes that might not apply to a tuple or may be unknown, is crucial.


4. Interpretation of Relation 

It is possible to interpret the relation schema as either a declaration or a certain kind of assertion. For example, the STUDENT relation schema states that a student entity typically has a name, home phone number, address, and GPA. It is then possible to interpret each tuple in the relation as an unique instance of the relation.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Top Post Ad

Below Post Ad