Random Trees Interview Question

One python program and one SQL program. Different SQL based questions