self join in sql with examples | sql server interview question and answer| cricket matches |Part 10

preview_player
Показать описание
Very common sql server interview question.
Must watch full video guys and do subscribe and please share to others.
Query is available in the comment box.
Комментарии
Автор

CREATE TABLE TEAM
(
TEAMID INT,
TEAMNAME VARCHAR(20)
)
INSERT TEAM VALUES (1, 'IND'), (2, 'AUS'), (3, 'SL'), (4, 'PAK')

SELECT * FROM TEAM

SELECT T.TEAMNAME+' VS '+T1.TEAMNAME as MATCHES
FROM TEAM AS T
INNER JOIN
TEAM AS T1
ON T.TEAMID < T1.TEAMID

ssunitech
Автор

Hello susheel sir...this is shubham singh...ur videos are informative...

cricketfever
Автор

cross apply also work as inner join.
select a.team_id, a.team_name + ' vs '+ c.team_name from cricket a
cross apply (select * from cricket b
where a.team_id < b.team_id) c

narendrakishore
Автор

Thanks for explaination. but what is solution if we dont have team id

pankajdhatrak
Автор

Now we can calculate the IPL matches list..Lol

ManishSharma-jsbr