
- DBMS Tutorial
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- DBMS - Generalization, Aggregation
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Algebra
- DBMS - ER to Relational Model
- DBMS- SQL Overview
- Relational Database Design
- DBMS - Database Normalization
- DBMS - Database Joins
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Hashing
- Transaction And Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
Write queries using aggregate functions in relational algebra (DBMS)?
The aggregate functions are follows −
max()
min()
sum()
average()
count()
Consider the following tables −
Employee − Emp(empid,ename,salary)
Empid | Empname | Salary |
---|---|---|
E1 | Ravi | 4000 |
E2 | Sanjay | 3500 |
E3 | Sruthi | 3000 |
E4 | Alok | 3000 |
E5 | Pritam | 3000 |
Dept − Dept(deptid,dname)
Depid | Dname |
---|---|
D1 | Cse |
D2 | Ece |
D3 | Civil |
Project − Project(projected,pname)
Projectid | Pname |
---|---|
P1 | Database |
P2 | networking |
Worksin − Worksin(empid,depid)
Empid | Depid |
---|---|
E1 | P1 |
E2 | P2 |
E3 | P1 |
E4 | P2 |
E5 | P2 |
Assign − Assign(empid,projectid)
Empid | Projectid |
---|---|
E1 | P1 |
E2 | P2 |
E3 | P1 |
E4 | P2 |
E5 | P2 |
Example 1
Display the details of the employee who works in the ece department.
Step 1
Use the below mentioned syntax. Here, T1= deptid of Ece
T1=∏deptid(σdname=ece(dept))
Output
Deptid |
---|
D2 |
Step 2
Here, ⋈= {T1.deptid=worksin.deptid} and T2= all empid of Ece
T2= ∏empid(T1⋈worksin)
Output
Empid |
---|
E3 |
E4 |
Step 3
Here, T3=(T2⋈emp), ⋈={T2.empid=emp.empid} and T3= details of all employees of Ece
Empid | Empname | Salary |
---|---|---|
E3 | Smruthi | 3000 |
E4 | Alok | 3000 |
Example 2
Display all names of employees who work on database projects.
Step 1
Use the command mentioned below −
T1=∏projectid(σpname=database(project))
Output
Projectid |
---|
P1 |
Step 2
Use the command given below −
T2= ∏empid(T1⋈assign)
Output
Empid |
---|
E1 |
E2 |
Step 3
Use the command given below −
T3= ∏empname(T2⋈emp)
Output
Empname |
---|
Ravi |
Smruti |
- Related Articles
- Explain the relational algebra in DBMS?
- Aggregate Functions in DBMS
- Explain project operation in relational algebra (DBMS)?
- Explain rename operation in relational algebra (DBMS)?
- Explain union operation in relational algebra (DBMS)?
- Explain intersection operation in relational algebra (DBMS)?
- Explain cartesian product in relational algebra (DBMS)?
- Explain division operation in relational algebra (DBMS)?
- Explain the select operation in relational algebra (DBMS)?
- What is join operation in relational algebra (DBMS)?
- Explain the binary operations in relational algebra (DBMS)?
- Explain the evaluation of relational algebra expression(DBMS)
- Explain aggregate functions with the help of SQL queries
- Difference between Relational Algebra and Relational Calculus
- Basic Operators in Relational Algebra

Advertisements