
Keeping it simple—The key to build a good query
Before you go on to the next chapter, an important concept needs to be kept in mind:
Tip
Keep it simple is the key to success to create queries efficiently.
Simplicity is in need everywhere in the current changing world. Wherever you make things complicated, you may find yourself in an awkward position to compete with others.
My slogan is: simple, simpler, the simplest.
I have a habit in query building: the last step for any new query would be checking to see if it is the simplest one. In this way, "keep it simple" would not only be kept in the already built query, but also helps new queries to be the simplest in the beginning.
By keeping a query as simple as possible, it will ensure that the system performance is not affected. It will also be a great help to the troubleshooting process. A short checklist for simplicity is as follows:
- Other queries: Are there any other queries doing a similar job, and if yes, why does the new query need to be built?
- Tables: Are there any tables that have not been used for the query?
- Fields: Are there any fields that have not been used for the query?
- Conditions: Are there any condition overlaps?
The list can be much longer. The meaning behind it is clear: there is a never ending battle to get rid of complications.
When you try this method and it becomes a routine, you will find that query building becomes an enjoyable process.