We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In T-Sql, regardless of database engine you use, I would suggest you use Case; as most don't support IF/ELSEIF/IF condition blocks. Even in SQL server its IIF and then you have to nest the ELSE IF part. THe query you tried using only works in the MySQL database engine.
As to your other question P=BST.N is saying the column P inside the query is joining to the outside table (in this case its a self-join) the BST is the alias of the outside table.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Tree Nodes
You are viewing a single comment's thread. Return to all comments →
In T-Sql, regardless of database engine you use, I would suggest you use Case; as most don't support IF/ELSEIF/IF condition blocks. Even in SQL server its IIF and then you have to nest the ELSE IF part. THe query you tried using only works in the MySQL database engine.
As to your other question P=BST.N is saying the column P inside the query is joining to the outside table (in this case its a self-join) the BST is the alias of the outside table.