Header Ads

Header ADS

How do you select all even or odd numbers in a table?

How do you select all even or odd numbers in a table?

Topic Introduction: In this tutorial, we will show how you select all even or odd numbers in a table?




Even numbers:  MOD (column name, 2) = 0

SELECT employee_id
  FROM EMPLOYEES
 WHERE MOD (employee_id, 2) = 0

Odd numbers:   MOD (column name, 2) = 1

SELECT employee_id
  FROM EMPLOYEES
 WHERE MOD (employee_id, 2) = 1






No comments

Theme images by Deejpilot. Powered by Blogger.