Deterministic and Non Deterministic Functions

1. Deterministic Functions:

           Always return the same value until and unless the state of database is changed. 

For example: some aggregate functions like 

-sum(), square(3) -- no matter how many time you press f5 the value of the result will be same until and unless the state of the database is changed.


2. Non- Deterministic Functions:

          Always return different values even if the database state is not changed. for example

getDate()

current_timestamp()


hybrid:

rand() function :
            rand is used to generate random numbers.

but if seed is provided to rand(1) -- it behaves Deterministic which means value doesn't change 

but if the seed is not provided to rand ()-- it behaves non deterministic even if the state of Database is not changed.

Comments