Completed SQL homework