Professional Documents
Culture Documents
SQL Query Documentation
SQL Query Documentation
SQL Query Documentation
Expected output.
Query 2
Query 3
Query 4
Query - 5
Query 6
Query 7
Query 8
Query 9
Query 10
Query 11
select n,if (1=(select count(*) from bst as b where b.n = a.n
and b.p is null),'Root', if (0=(select count(*) from bst as c
where c.p = a.n),'Leaf','Inner')) from bst as a
group by n
order by n
Window Function
Assign a unique row number to each row in the employees table, ordered by
employee_id.
SELECT * ,row_number() over(order by id ) as row_numbers from employees;