If I have the table
SELECT (Firstname || \'-\' || Middlename || \'-\' || Surname) AS example_column
FROM example_table
This will
If you use Postgres, concat_ws() is what you are looking for:
SELECT concat_ws('-', Firstname, Middlename, Surname) AS example_column
FROM example_table
SQLFiddle: http://sqlfiddle.com/#!15/9eecb7db59d16c80417c72d1e1f4fbf1/8812
To treat empty strings or strings that only contain spaces like NULL use nullif():
SELECT concat_ws('-', Firstname, nullif(trim(Middlename), ''), Surname) AS example_column
FROM example_table