Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
SQL Server 119
#SQLServer 88
Oracle 70
#SQL SERVER 35
BRH 31
SQL Server 2012 29
denali 23
#TSQL 19
TSQL 19
C# 15

Archive · View All
October 2011 31
November 2011 30
September 2011 30
August 2011 18
December 2011 15
July 2011 13
June 2011 8
May 2012 4
April 2012 3
January 2010 3

Day 47: Remainder function of Oracle

Oct 30 2011 11:20PM by Niladri Das Gupta   

Let Us Learn Oracle - Part 47 of N [ Remainder Function of Oracle 10g ]

Syntax: Remainder(x,y)

Purpose: It returns the remainder of x divided by y. It is similar to Mode function but the difference is that it uses Round function while Mod uses Floor function in it's formula while computing.


SQL> Select Remainder(10.75,6.99)RemainderExample, Mod(10.75,6.99) ModExample
  2  From Dual;

REMAINDEREXAMPLE MODEXAMPLE
---------------- ----------
           -3.23       3.76

Now let us see how the value of remainder function appears. It is calculated on the basis of the below formula

 x-(y * Round(x/y))

So we have

x = > 10.75

y => 6.99

Round (x/y) => 2

Now if we apply the values into the above formula and run the below query, we will get the same answer.

SQL> Select 10.75 - (6.99 * Round(10.75/6.99)) RemainderExample
  2  From Dual;

REMAINDEREXAMPLE
----------------
           -3.23

As said, Mod function uses Floor internally and henceforth the formula will be

 x-(y * Floor(x/y))

So we have

x = > 10.75

y => 6.99

Floor (x/y) => 1

Now if we apply the values into the above formula and run the below query, we will get the answer.


SQL> Select 10.75 - (6.99 * Floor(10.75/6.99)) ModExample
  2  From Dual;

MODEXAMPLE
----------
      3.76

So we understand the difference between Remainder and Mod function. I hope it is simple to make such a function in Sql Server as Floor and Round functions are both available in SQL Server

Thanks for reading

Tags: SQL Server, Oracle, #SQL SERVER,


Niladri Das Gupta
7 · 21% · 6710
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Day 47: Remainder function of Oracle" rated 5 out of 5 by 1 readers
Day 47: Remainder function of Oracle , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]