Skip to main content

Relational Decomposition

Relational Decomposition
  • When a relation in the relational model is not in appropriate normal form then the decomposition of a relation is required.
  • In a database, it breaks the table into multiple tables.
  • If the relation has no proper decomposition, then it may lead to problems like loss of information.
  • Decomposition is used to eliminate some of the problems of bad design like anomalies, inconsistencies, and redundancy.

Types of Decomposition

Relational Decomposition


Lossless Decomposition
  • If the information is not lost from the relation that is decomposed, then the decomposition will be lossless. 
  • The lossless decomposition guarantees that the join of relations will result in the same relation as it was decomposed.
  • The relation is said to be lossless decomposition if natural joins of all the decomposition give the original relation.

Example:

EMPLOYEE_DEPARTMENT table:

EMP_ID

EMP_NAME

EMP_AGE

EMP_CITY

DEPT_ID

DEPT_NAME

22

Denim

28

Mumbai

827

Sales

33

Alina

25

Delhi

438

Marketing

46

Stephan

30

Bangalore

869

Finance

52

Katherine

36

Mumbai

575

Production

60

Jack

40

Noida

678

Testing



The above relation is decomposed into two relations EMPLOYEE and DEPARTMENT

EMPLOYEE table:

EMP_ID

EMP_NAME

EMP_AGE

EMP_CITY

22

Denim

28

Mumbai

33

Alina

25

Delhi

46

Stephan

30

Bangalore

52

Katherine

36

Mumbai

60

Jack

40

Noida



DEPARTMENT table

DEPT_ID

EMP_ID

DEPT_NAME

827

22

Sales

438

33

Marketing

869

46

Finance

575

52

Production

678

60

Testing



Now, when these two relations are joined on the common column "EMP_ID", then the resultant relation will look like this:

Employee ⋈ Department

EMP_ID

EMP_NAME

EMP_AGE

EMP_CITY

DEPT_ID

DEPT_NAME

22

Denim

28

Mumbai

827

Sales

33

Alina

25

Delhi

438

Marketing

46

Stephan

30

Bangalore

869

Finance

52

Katherine

36

Mumbai

575

Production

60

Jack

40

Noida

678

Testing



Hence, the decomposition is Lossless join decomposition.

Dependency Preserving
  • It is an important constraint of the database.
  • In the dependency preservation, at least one decomposed table must satisfy every dependency.
  • If a relation R is decomposed into relation R1 and R2, then the dependencies of R either must be a part of R1 or R2 or must be derivable from the combination of functional dependencies of R1 and R2.
  • For example, suppose there is a relation R (A, B, C, D) with functional dependency set (A->BC). The relational R is decomposed into R1(ABC) and R2(AD) which is dependency preserving because FD A->BC is a part of relation R1(ABC).

Comments

Popular posts from this blog

All About Microservices Architecture

All About Microservices Architecture **Microservices Architecture** is an approach to software development where a large application is broken down into smaller, independent services that can operate and be deployed independently. Instead of building a monolithic application, which is a single, tightly-integrated unit, microservices architecture divides the functionality into separate services that communicate with each other through well-defined APIs (Application Programming Interfaces). Key characteristics of microservices architecture include: 1. **Modularity:** Each microservice represents a specific business capability and can be developed, deployed, and scaled independently. 2. **Independence:** Microservices are autonomous, meaning they can be developed, deployed, and updated without affecting the entire system. This independence allows for faster development cycles. 3. **Scalability:** Since each service is independent, you can scale only the specific microservices that require...

Relational Calculus

Relational Calculus There is an alternate way of formulating queries known as Relational Calculus. Relational calculus is a non-procedural query language. In the non-procedural query language, the user is concerned with the details of how to obtain the end results. The relational calculus tells what to do but never explains how to do. Most commercial relational languages are based on aspects of relational calculus including SQL-QBE and QUEL. Why it is called Relational Calculus? It is based on Predicate calculus, a name derived from branch of symbolic language. A predicate is a truth-valued function with arguments. On substituting values for the arguments, the function result in an expression called a proposition. It can be either true or false. It is a tailored version of a subset of the Predicate Calculus to communicate with the relational database. Many of the calculus expressions involves the use of Quantifiers. There are two types of quantifiers: Universal Quantifiers: The univer...

Natural Language Processing (NLP)

What is Natural Language Processing (NLP) ? Natural Language Processing (NLP)* is a field of artificial intelligence (AI) that focuses on the interaction between computers and humans using natural language. It involves the development of algorithms and models that enable computers to understand, interpret, and generate human language. Here are key aspects of NLP: 1. *Text Understanding:* NLP systems aim to comprehend the meaning of written or spoken language. This involves tasks such as text classification, sentiment analysis, and named entity recognition. 2. *Speech Recognition:* NLP extends to processing spoken language, converting audio signals into text. This technology is used in voice assistants, transcription services, and more. 3. *Language Generation:* NLP systems can generate human-like text. This is employed in chatbots, language translation services, and content generation. 4. *Machine Translation:* NLP is fundamental to machine translation systems that enable the automatic...