• +91 9723535972
  • info@interviewmaterial.com

DBMS Interview Questions and Answers

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:

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:

SELECT CustomerID FROM (SELECT rowno, CustomerID from Customers) where mod(rowno,2)=1;

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners