Can we use switch case to filter the columns of a table in this way?
select distinct stud.name, stud.num,
case WHEN stud.sub like '%data%' THEN stud.sub
WHEN stud.sub like '%informatics%' THEN stud.sub
WHEN stud.sub like '%genomics%' THEN stud.sub
ELSE '---'
END
from table_A
The expected result is
Name ID Sub
victor 2098 -----
Lui 6754 Bioinformatics
Willis 7653 Advanceddatascience
Thanks!