How can you select all the even number records from a table? All the odd number records? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can you select all the even number records from a table? All the odd number records?

After you learned all about the SELECT command answer me that question ❓

9th Jul 2016, 2:03 AM
LABIAD Cherif Ameur
7 Answers
+ 2
I having the answer, but I'll letting you try.
9th Jul 2016, 2:25 AM
LABIAD Cherif Ameur
0
If column then we can use MOD function if records needed then using row number we can find I guess. let me know the answer if I'm wrong.
9th Jul 2016, 9:19 AM
Manu
0
So, thank you very much MANASA for your try, your answer is wrong. To select all the even number records from a table: Select * from table where id % 2 = 0 To select all the odd number records from a table: Select * from table where id % 2 != 0
9th Jul 2016, 1:57 PM
LABIAD Cherif Ameur
0
For Manasa, The SQL MOD() function returns the remainder from a division.
9th Jul 2016, 1:59 PM
LABIAD Cherif Ameur
0
hi
10th Jul 2016, 11:07 AM
Sravan Kumar
Sravan Kumar - avatar
0
Okay Thanks
11th Jul 2016, 4:58 AM
Manu
0
You're welcome Manasa
11th Jul 2016, 11:33 AM
LABIAD Cherif Ameur