Search code examples
mysqlsqlrdbms

Joining name in SQl


I am new to SQL and i am tasked with joining the first name and last name of actors in MySQL.

select first_name ||''|| last_name name
from actor
order by actor_id;

I did this but it is not working. All i get is a string of Zeros. something like

0
0
0
0
0
0
0
0
0

If someone could help me solve this problem. that will be wonderful.


Solution

  • Try to use Concat Function

    select CONCAT(first_name, last_name) AS name
    from actor
    order by actor_id;
    

    Further details are here