I'm trying to select the first name and last name and ONLY select the middle name when there is one. The logic of my query makes sense. Every time I am extracting the first name, last name, and birth. Only when the middle is not null I want the middle name to be extracted as well. I get a syntax error when I run this query.
SELECT first, last, birth
WHEN middle IS NOT NULL THEN (SELECT middle FROM students)