Never ever execute queries that are not read only on your database directly.
It makes no sense to do that except outplaying the application and may lead to damage and data loss.
I understand, but I want to modify the Zammad functionality from another application that can only work directly with the database. Is there really no way to make SQL updates?
Technically your problem is that cache is not dropped after touching database. You may drop cache by running Cache.clear in Zammad Rails console after updating database. Beware that this is a fragile unsupported solution that will cause issue sooner or later
Sooner than later. We strongly discourage anyone from changing any value in the database directly - especially at runtime. No matter if the cache is cleared or not. This is error prone to race conditions and leads to unpredictable behaviour and long debugging sessions - headaches included.
That’s what APIs are for. REST or Ruby is the only way to go here.