Which of the sql is the correct one?