In this article, I want to show you queries might sometimes return results which may look strange at first glance. You need to remember the devil is in the detail while creating queries 😈
While developing apps, developers have a case when they need to get data from the same table of DB, which aren't often changed, quite regularly.
store settings or
user settings are good examples what I mean. If an app is quite complex, the app'll need to get these data a minimum of several times during a request. It might be an optimisation problem for DB. In this article, I'm showing how to solve cases like that.
UNION ALL are very similar - both combines result-set of
SELECT queries, but the final sets are different. Let me allow to show you differences.
While developing apps, software developers often have to be sure that a database won't have duplicated data. Users are one of the best example. An username or an email has to be unique for one app. It might seem to be a trivial issue but for some cases, a solution is more sophisticated.