Interesting one. The explanation given isn't quite correct:
2. len(case name when 'master' then 'other' else 'name' end) > 4 --only the length of 'master' > 4, all other db's are changed to 'name', which length =4.
its not the len of the word 'master' being compaired, but the lenth of the word 'other'.