Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rajeshtva's avatar

What is the rule regarding use on ON keyword while joining?

This is about another hackerrank problem on sql. This is the solution i found from internet.

select 
if(GRADE<8,NULL,NAME),
GRADE,MARKS 
FROM STUDENTS AS S JOIN GRADES AS G
WHERE S.MARKS BETWEEN G.MIN_MARK AND G.MAX_MARK
ORDER BY GRADE DESC, NAME ASC;

this solution works like charm. I solved it by using another method. but i don't get why there is no ON keyword used while joining. i can't find any reliable solution. please suggest me some link for a good read on this topic and explain this thing.

Any help would be deeply appreciated. Thank you

0 likes
2 replies
kokoshneta's avatar
Level 27

This is explained quite clearly on literally the first page that pops up when you Google “MySQL join without ON”: https://tableplus.com/blog/2019/09/sql-join-without-on.html.

Don’t forget that this is a Laravel forum, not a MySQL forum. That doesn’t mean SQL is off-topic, but questions that are only about SQL and have nothing to do with Laravel are probably better asked elsewhere.

rajeshtva's avatar

@kokoshneta when i searched this page didn't pop up. otherwise i wouldn't have asked it here. but thanks for this.

and i will take care about it in future.

Please or to participate in this conversation.