There are following way to find List of employees whose EmpId is an odd value in Oracle database.
- Here first we have created one Employee table.
- In that table there are 5 column Empid, name, age, address and salary.
Select * from Employee;
Using mod (%) :-
Select * from Employee where mod(EmpId,2) = 1;
Here we are use EmpId with mod function,if reminder will be 1 then its print employees data whose EmpId is an odd value.
Using mod(%) with ROWNUM :-
Select * from Employee where mod(EmpId,2) = 1 And ROWNUM < 10;
- Here we are use EmpId with mod function,if reminder will be 1 then its print employees data whose EmpId is an odd value.
- Also use Rownum < 10 to get the only 9 or less number of records.