Find the Remainder !!

MOD

Syntax: MOD (dividend, divisor)

Parameters: dividend and divisor are the numeric values or columns containing numeric values.

Return type: The MOD function returns a numeric value.

Usage:
Manager wanted to give the salary to all the employees in Cash. She has all 100 dollar notes. She is interested to know how much change she has to give to each employee apart from 100 dollar notes.

Manager to Data analyst: Bring me the list of all employees and the remaining amount after paying them in hundreds of dollars. Data analyst runs the below query to fetch the required data.

SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, MOD(SALARY, 100) AS REMAINING_AMOUNT FROM EMPLOYEES ORDER BY REMAINING_AMOUNT DESC;


Comments

Popular posts from this blog

Let's learn Left Outer Join!

Let's extract STRING!

Let's learn Cross Join!