Here, we will first insert a records into the Employee table and then we will fetch odd and even records from employee table. Please see the below screenshot i.e. adding multiple records in Employee table with insert query:
FETCH ODD RECORDS: Now, we will first fetch the odd records from Employee table by using query i.e.
SELECT * FROM EMPLOYEE WHERE ID % 2 != 0
OR
SELECT * FROM EMPLOYEE WHERE ID % 2 < > 0
Please see the below screenshot for further clarification.
FETCH EVEN RECORDS: To fetch the even records from Employee table, we will use query i.e.
SELECT * FROM EMPLOYEE WHERE ID % 2 = 0
Please see the below screenshot for further clarification.
- - - - - - Cheers, Happy to Help! - - - - - -
No comments:
Post a Comment