Question - Mention a query to calculate the even and odd records from a table
Answer -
To write a query to calculate the even and odd records from a table, you can write two different queries by using the MOD function.
So, if you want to retrieve the even records from a table, you can write a query as follows:
1 SELECT CustomerID FROM (SELECT rowno, CustomerID from Customers) where mod(rowno,2)=0;
Similarly, if you want to retrieve the odd records from a table, you can write a query as follows:
1 SELECT CustomerID FROM (SELECT rowno, CustomerID from Customers) where mod(rowno,2)=1;