/    /  DBMS – Domain Relational Calculus

Domain Relational Calculus

 

This is a ‘non-procedural query language’, whereas ‘Relational Algebra’ is a ‘procedural query language’.

This language uses domain variables that take on values from an attributes domain, instead of the values for an entire tuple.

 

Formal Definition :

 

An expression in the DRC is of the form :

 

                    { < x1, x2, …,xn >  /  P ( x1, x2, …, xn ) }

 

Here,  < x1, x2, …,xn > ϵ r,  where ‘r’ is a relation on ‘n’ attributes and x1, x2, …,xn  are domain variables.

 

Consider the following relation: 

R1 :  FACULTY-1

FNoFNameDNoQualSalary
22Riya21Ph.D55000
24Priya22M. Tech50000
25Zayn22M. Tech42000
27Harry23M. Tech28000
30Sia23M. Tech32000
33Max24Ph.D53000
35Fred24Ph.D52000
37Diva25M. Tech26000
39Ben25M. Tech24000
40Trent25M. Tech34000

Example-1 :  Find the Faculty No, Faculty name, DNo, Qual and salaries of all the faculty, who are drawing more than 30000.

 

      { < f, n, d, q, s > / < f, n, d, q, s > ϵ FACULTY-1 ˄ s > 30000 }

 

 Output :          

FNoFNameDNoQualSalary
22Riya21Ph.D55000
24Priya22M. Tech50000
25Zayn22M. Tech42000
30Sia23M. Tech32000
33Max24Ph.D53000
35Fred24Ph.D52000
40Trent25M. Tech34000

 

Example-2 :  Find the Faculty No, Faculty name  of all the faculty, who are drawing more than 40000.

 

        { < f , n > / <  Ǝ d, q, s (  < f, n, d, q, s > ϵ FACULTY-1 ˄ s > 40000 }

Output : 

FNoFName
22Riya
24Priya
25Zayn
33Max
35Fred

 

Example-3 :  Find the names of students who are studying in IT department.

{ < n > / Ǝ  s, d  (< s, n, d > ϵ STUD  ˄ Ǝ  m ( < d , m > ϵ DEPT˄ m = ‘IT’ ) }

 

Output :   

SName
Zayn 
Harry

 

Example-4 :  Find the name of the department where ‘pqr’ is studying.

 

  { < m > / Ǝ d ( <d,m> ϵ DEPT ˄ Ǝ s,n ( < s , n , d > ϵ STUD˄ n = ‘pqr’ ) }

 

Output :   

DName
CSE

 

Reference Links

Domain Relational Calculus