Advanced SQL: Using MOD()

365 Days of Daily Coding: Day 158

Hello All, I am posting this after so long. Wow! As usual there’s tons of activities and things that have happened in my life that has particularly occupied most of my mental capacity and energy. I am hoping that I can recover well.

I have decided not to continue watching the python youtube tutorial because I figured out that it wasn’t that helpful. You watch it and then you forget about it after a while. The best way to learn is by actually doing some projects. So I am gonna do something along this line. 🙂

WITH temp AS (
SELECT 1 AS Valued FROM DUAL UNION ALL
SELECT 2 AS Valued FROM DUAL UNION ALL
SELECT 3 AS Valued FROM DUAL UNION ALL
SELECT 4 AS Valued FROM DUAL UNION ALL
SELECT 5 AS Valued FROM DUAL UNION ALL
SELECT 6 AS Valued FROM DUAL UNION ALL
SELECT 7 AS Valued FROM DUAL UNION ALL
SELECT 8 AS Valued FROM DUAL UNION ALL
SELECT 9 AS Valued FROM DUAL UNION ALL
SELECT 10 AS Valued FROM DUAL)

SELECT Valued FROM (
SELECT Valued, MOD(Valued,2) AS Remainders
FROM temp)
WHERE Remainders = 1

One response to “Advanced SQL: Using MOD()”

Leave a comment