We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It is the qualifier for the WHERE statement.
(Id % 2) tells SQL to divide the Id by 2 and return the remainder. Since we're looking for only even values we set this to "= 0", as 2%2=0, 4%2=0, etc.
If we were looking for odd-numbered Ids, we'd use "= 1" instead, since there's always a remainder of 1 when dividing odd numbers by 2.
Hope this helps!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 3
You are viewing a single comment's thread. Return to all comments →
It is the qualifier for the WHERE statement. (Id % 2) tells SQL to divide the Id by 2 and return the remainder. Since we're looking for only even values we set this to "= 0", as 2%2=0, 4%2=0, etc. If we were looking for odd-numbered Ids, we'd use "= 1" instead, since there's always a remainder of 1 when dividing odd numbers by 2. Hope this helps!