How to fetch Alternate Records from the Table | SQL Interview Question

preview_player
Показать описание
How to fetch Alternate Records from the Table | SQL Interview Question

In this video , I have explained how to find How to fetch Alternate Records from the Table
Alternate Records can be either Even numbered row or Odd numbered row.

-------------------------------------------------------------------------
Follow me on Social Networking Sites :
-------------------------------------------------------------------------
*Twitter:
*Instagram :

-------------------------------------------------------------------------
Table and Insert SQL Script :
-------------------------------------------------------------------------
Create Table Students(
Id Varchar(10),
Name Varchar(30),
Gender Char(1)
)

Insert into Students Values ('S1001','James','M');
Insert into Students Values ('S1002','Henry','M');
Insert into Students Values ('S1003','Emma','F');
Insert into Students Values ('S1004','David','M');
Insert into Students Values ('S1005','Mary','F');
Insert into Students Values ('S1006','Thomas','M');
Insert into Students Values ('S1007','Daniel','M');
Insert into Students Values ('S1008','Steven','M');
Insert into Students Values ('S1009','Mark','M');
Insert into Students Values ('S1010','Karen','F');

-------------------------------------------------------------------------------------------------------------------------------------------------------
#AlternateRecords #SQL
#SQLInterviewQuestionsandanswers #sqlInterviewQuestions #sqlInterviewQuestionsForTesting #sqlInterviewQuestionsQuery #sqlInterviewQuestionsOnJoins #sqlTechnicalInterviewQuestions #SQLforETLTesters #CommonSqlInterviewQuestions #ETLTesting #ITJUNCTION4ALL #SunilKumar
Рекомендации по теме
Комментарии
Автор

You're doing a great job.. helping a lot of job aspirants in their journey. 👍

aseshsahoo
Автор

Thanks for the crystal clear explanation sir

NRNov
Автор

I have one doubt why do we have put that entire thing in brackets (which is A) ?

prachidev
Автор

May I know Can we use Rank or dense_rank instead of row_number???

shashanksingh
Автор

select * from Students
where mod(right(id, 1), 2) = 0;
select * from Students
where mod(right(id, 1), 2) != 0;

bishwarup
Автор

select *
from people
where id%2 = 1



select *
from people
where id%2 = 0

shailendrarai