Why does earth have oxygen?

Earth has oxygen because we have trees.