
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Explain union operation in relational algebra (DBMS)?
Query is a question or requesting information. Query language is a language which is used to retrieve information from a database.
Query language is divided into two types −
Procedural language
Non-procedural language
Procedural language
Information is retrieved from the database by specifying the sequence of operations to be performed.
For Example − Relational algebra.
Structure Query language (SQL) is based on relational algebra.
Relational algebra consists of a set of operations that take one or two relations as an input and produces a new relation as output.
Types of Relational Algebra operations
The different types of relational algebra operations are as follows −
Select operation
Project operation
Rename operation
Union operation
Intersection operation
Difference operation
Cartesian product operation
Join operation
Division operation
Union, intersection, difference, cartesian, join, division comes under binary operation (operate on two tables).
Union operation
Union operation combines values in R1, R2 by removing duplicate ones.
Syntax
∏regno(R1) ∪ ∏regno(R2)
It displays all the regno of R1 and R2.
Example
Consider two tables R1 and R2 −
Table R1 is as follows −
Regno | Branch | Section |
---|---|---|
1 | CSE | A |
2 | ECE | B |
3 | MECH | B |
4 | CIVIL | A |
5 | CSE | B |
Table R2 is as follows −
Regno | Branch | Section |
---|---|---|
1 | CIVIL | A |
2 | CSE | A |
3 | ECE | B |
To display all the regno of R1 and R2, use the following command −
∏regno(R1) ∪ ∏regno(R2)
Output
Regno |
---|
1 |
2 |
3 |
4 |
5 |
To retrieve branch and section of student from table R1 and R2, use the below mentioned command −
∏ branch, section (R1) ∪ ∏ branch, section (R2)
Output
Branch | Section |
---|---|
CSE | A |
ECE | B |
MECH | B |
CIVIL | A |
CSE | B |
No repletion allowed for entry.
Union All − It is used for duplicate entries. The common entries will be shown if the common intersection is used.
- Related Questions & Answers
- Explain rename operation in relational algebra (DBMS)?
- Explain project operation in relational algebra (DBMS)?
- Explain intersection operation in relational algebra (DBMS)?
- Explain division operation in relational algebra (DBMS)?
- Explain the select operation in relational algebra (DBMS)?
- Explain the relational algebra in DBMS?
- What is join operation in relational algebra (DBMS)?
- Explain cartesian product in relational algebra (DBMS)?
- Explain the binary operations in relational algebra (DBMS)?
- Explain the evaluation of relational algebra expression(DBMS)
- Write queries using aggregate functions in relational algebra (DBMS)?
- Explain the Relational Model in DBMS?
- Difference between Relational Algebra and Relational Calculus
- Basic Operators in Relational Algebra
- Explain the unary operations of algebra relations in DBMS?