How to add space between two name columns concatenated in SQL ?
SELECT CONCAT(a.first_name, a.last_name), f.title, f.description, f.length
FROM actor a
JOIN film_actor fa
ON a.actor_id = fa.actor_id
JOIN film f
ON f.film_id = fa.film_id
i want to have space between names like "PenelopeGuiness" to "Penelope Guiness"
3
Answers
I tried to add
' '
inside CONCATE parameters but id did not work! Anyway, I just found below solution and it worked.Each of these concatenates a space character in between:
(The first form with basic concatenation operator being very slightly cheaper.)
But each form handles NULL input differently. You typically want "NULL-safe" concatenation with
concat_ws()
if that can happen. Detailed assessment: