Add data from rows to different columns if more than 1 row have a partial match
Welcome.

Try this.

select name, surname, 
    max(prog1) as prog1, max(prog2) as prog2, max(prog3) as prog3 
 from
    (select name, surname, 
     if(program= 'program1', 'program1', '') as prog1, 
     if(program= 'program2', 'program2', '') as prog2, 
     if(program= 'program3', 'program3', '') as prog3 
    from db1) as tempdb
 group by name, surname;


This is possible only if the three program values are fixed / known prior to the code (itself). 

For unknown values of program this is not possible directly. In such case, you may have to move them to another table / temporary table / view by multiplying columns and then assembling the same into one with more columns.