Final SQL submission. Needs reviewing.