![]() In each case we maintain a high degree of visual understanding based on the available versus needed space. Those are not written on their own line, nor need they be, since it’s just two words. We compare that to the two GROUP BY columns. What is clear about this query? Immediately we see that we are getting back three result columns, as they are written each on their own line. Let’s take the first demonstration query from the website at a target width of 50: SELECT Indeed what we would like is for the query to use more lines of space and highlight subqueries and other blocks by clearly indenting them. What if we named many columns in it, many tables in the FROM, added filters and sorts, with subqueries and joins of varying depth? As a query gains complexity, it deserves more space. Why use four lines when one will do?īut let us now slowly increase the complexity of our query. This feels like YAGNI applied to text formatting. The four lines used by the third rendering have wasted a maximum amount of screen space for zero additional benefit in terms of visual understanding. Let us assume we had some 80 characters of width in which to work (an archaic, standard, if not small, editor size). For me, the second and third renderings detract by using whitespace needlessly. This statement contains a mere four words that are instantly parseable by the mind. Which one is the most understandable visually? For me, it is the first. Here are some possible renderings of this query: SELECT a FROM t To demonstrate, let’s take, for example, a query SELECT a FROM t. ![]() Always maintain visual alignment regardless of your editor configuration to use spaces or tabs at any tab width.Attempt to use available horizontal space in the best way possible. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |