DEV Community

[Comment from a deleted post]
Collapse
 
helenanders26 profile image
Helen Anderson

Thanks for the tips.

I should have mentioned that I'm looking at this from a data analysts point of view so the use case is writing a query on the database directly to pull back a dataset.

Collapse
 
mucio profile image
mucio

Unfortunately is a power that analysts often abuse (cases with many condition in long queries), my suggestion is usually to try to put the case logic in a function. It can be maintained more easily, the query is shorter and less prone to errors