{"id":358,"date":"2018-05-31T17:38:59","date_gmt":"2018-05-31T15:38:59","guid":{"rendered":"https:\/\/staging.sql.marcus-belz.de\/?p=358"},"modified":"2026-05-07T01:06:39","modified_gmt":"2026-05-06T23:06:39","slug":"formatting-sql-statements-part-1","status":"publish","type":"post","link":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en","title":{"rendered":"Formatting SQL Statements (Part 1)"},"content":{"rendered":"<p><a href=\"https:\/\/staging.sql.marcus-belz.de\/?p=266\">Dieser Artikel in Deutsch&#8230;<\/a><\/p>\n<h2>Overview<\/h2>\n<p>Capital letters are often used to emphasize single words. This applies, for example, to German as a language. Latin, Greek, &#8230; Although there are languages that do distinct between upper and lower case (with respect to nouns), it has nevertheless prevailed in most languages. Even in English you can sometimes find nouns with a starting capital letter. That applies not only to the spoken language, but also to programming languages or naming conventions for programming. For example, the <em>CamelCase<\/em> notation states that in compound words, the first letters of each word are capitalized.<\/p>\n<p style=\"padding-left: 30px;\"><strong>CamelCase<\/strong><\/p>\n<p>You can also find a trend where the first word of a compound word starts with a small letter:<\/p>\n<p style=\"padding-left: 30px;\"><strong>camelCase<\/strong><\/p>\n<p>With that, the use of capital letters is also a commonly used convention for marking words, identifiers, function names, etc. in compound expressions.<\/p>\n<p>The definition of rules for the notation of identifiers, function names, etc. is widely accepted among programmers and ultimately leads to a naming convention that determines how the language elements of a programming language are to be written. Still, many developers find it challenging to adhere to naming conventions. In fact, it can often be observed that developers are not consistent with their &#8222;own&#8220; preferred convention.<\/p>\n<p>Compliance with naming conventions increases the readability of text in general and in programming. The same sentence again with deviations from generally known naming conventions that nouns are capitalized and adjectives, as well as verbs are written in small letters, the text becomes quickly illegible: &#8222;Compliance WITH nAming conventions INCREASES the Readability of text in general and in programming in Particular.&#8220;<\/p>\n<p>The following statement is defined in the view <strong>vTimeSeries<\/strong> in the database <strong>AdventureWorksDW2017<\/strong> and was slightly revised by me. I did not bother to follow any naming convention.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-381 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png\" alt=\"\" width=\"654\" height=\"272\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png 654w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001-300x125.png 300w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=382\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>In the following statement, function names are capitalized, all field names are delimited by square brackets, data types are written in lower case letters, and finally the statement is consistently aligned and formatted &#8230;<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008002.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-383 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008002.png\" alt=\"\" width=\"819\" height=\"480\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008002.png 819w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008002-300x176.png 300w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008002-768x450.png 768w\" sizes=\"auto, (max-width: 819px) 100vw, 819px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=384\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>Whether or not the applied formatting is preferred by the reader, we probably can agree on that the second statement appears to be more readable.<\/p>\n<p>With that there are some points identified being an essential part in a naming convention. In addition, there are a few other things to be discussed:<\/p>\n<ul>\n<li><a href=\"#H2_01\">Regular Identifier<\/a><\/li>\n<li><a href=\"#H2_02\">Delimiter<\/a><\/li>\n<li><a href=\"#H2_03\">The Spacer<\/a><\/li>\n<li><a href=\"#H2_04\">The Semicolon<\/a><\/li>\n<li><a href=\"#H2_05\">The Comma<\/a><\/li>\n<li><a href=\"#H2_06\">Funktion Names<\/a><\/li>\n<li><a href=\"#H2_07\">Aliases<\/a><\/li>\n<li><a href=\"#H2_08\">Qualified Field Names<\/a><\/li>\n<\/ul>\n<h2><a name=\"H2_01\"><\/a><strong>Regular Identifier<\/strong><\/h2>\n<p>Of course, all database objects have a name, the so-called identifier. Each database provider specifies rules for assigning a valid identifier. For example, in SQL Server, the length of identifiers is typically limited to 128 characters, and a regular identifier must not contain spaces. The exact definition of a regular identifier can be found in the online documentation:<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/databases\/database-identifiers?view=sql-server-2017\">https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/databases\/database-identifiers?view=sql-server-2017<\/a><\/p>\n<p>However, the definition of a regular identifier is, in my opinion, a much too broad definition.<\/p>\n<p>While \u2013 for example \u2013 the underscore <strong>_<\/strong> is widely used as a separating character between words, I usually avoid this character because the notation of a CamelCase identifier serves the same purpose and makes identifiers more compact.<\/p>\n<p>Special characters like the <strong>@<\/strong>, <strong>#<\/strong>und <strong>$<\/strong> are supported in regular identifiers. The use of these characters \u2013 in my opinion \u2013 makes an identifier illegible. These characters are too similar to letters from the Latin alphabet and yet cannot be directly grasped as such. That is why I usually try to avoid these characters.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=385\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-385 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008003.png\" alt=\"\" width=\"417\" height=\"96\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008003.png 417w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008003-300x69.png 300w\" sizes=\"auto, (max-width: 417px) 100vw, 417px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=386\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>I use only letters of the Latin alphabet <strong>[a-zA-Z]<\/strong> for identifiers. As long as it is possible, I try to avoid using numbers <strong>[0-9]<\/strong>, too. This reduces the number of rules for choosing a good identifier to only two rules:<\/p>\n<ul>\n<li>Use letters of the Latin alphabet<\/li>\n<li>If ever possible avoid numbers<\/li>\n<\/ul>\n<h2><a name=\"H2_02\"><\/a><strong>Delimiters<\/strong><\/h2>\n<p>Once an identifier contains a space, the identifier is no longer a regular identifier. However, non-regular identifiers are allowed if the identifiers are enclosed by either quotation marks (<strong>\u201c\u201d<\/strong>) or square brackets (<strong>[]<\/strong>). The use of non-regular identifiers is not a good programming style.<\/p>\n<p>The use of quotation marks is standard in most SQL dialects. Microsoft also allows square brackets here. Since delimiters differentiate identifiers visually from other elements of an SQL statement, delimiters contribute significantly to the readability of an SQL statement. I always use delimiters and I prefer square brackets over quotation marks.<\/p>\n<p>Among others I use delimiters for the following elements of the SQL vocabulary:<\/p>\n<ul>\n<li>Schemas<\/li>\n<li>Tables<\/li>\n<li>Views<\/li>\n<li>Field Names<\/li>\n<li>Aliases<\/li>\n<li>All programmable objects (Stored Functions, Stored Procedures, etc.)<\/li>\n<\/ul>\n<p>The following statement corresponds exactly to the second statement from this article. However, the identifiers are not noted with delimiters. Decide on your own which notation appears to be more readable:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008004.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-387 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008004.png\" alt=\"\" width=\"801\" height=\"480\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008004.png 801w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008004-300x180.png 300w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008004-768x460.png 768w\" sizes=\"auto, (max-width: 801px) 100vw, 801px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=388\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>Obviously, Microsoft prefers the use of square brackets over quotation marks. Many automatically created scripts are created by using square brackets as delimiters. SQL Server Management Studio (SSMS) uses \u2013 for example \u2013 square brackets for automatically generated SELECT and DDL statements (via the context menu for a table). Unfortunately, Microsoft is not very consistent here. When creating views via the wizard or showing the SQL statement in the SQL panel of the edit feature, Microsoft does not use delimiters, if delimiters are regular delimiters. The following two screenshots show automatically generated SQL statements. These statements can be regarded as a good example for how statements shall not be formatted with respect to the readability.<\/p>\n<h3><strong>View<\/strong><\/h3>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008005.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-389 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008005.png\" alt=\"\" width=\"500\" height=\"706\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008005.png 500w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008005-212x300.png 212w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<h3><strong>Edit Feature<\/strong><\/h3>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008006.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-390 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008006.png\" alt=\"\" width=\"500\" height=\"200\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008006.png 500w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008006-300x120.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>Using delimiter is only supported with <strong>SET QUOTED_IDENTIFIER ON<\/strong>. With <strong>QUOTED_IDENTIFIER OFF<\/strong> regular identifiers are no supported in SQL Server:<\/p>\n<p style=\"padding-left: 40px;\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/t-sql\/statements\/set-quoted-identifier-transact-sql?view=sql-server-2017%0d\">https:\/\/docs.microsoft.com\/en-us\/sql\/t-sql\/statements\/set-quoted-identifier-transact-sql?view=sql-server-2017<\/a><\/p>\n<h2><a style=\"font-size: inherit;\" name=\"H2_03\"><\/a><strong style=\"font-size: inherit;\">The Spacer<\/strong><\/h2>\n<p>The natural reading order (of an SQL statement) is left to right and top to bottom.<\/p>\n<p>While software code consists of quite a few short statements, SQL is designed to perform many operations in a single statement. A SQL statement can quickly cover hundred or more lines. With that, writing a good SQL statement appears to be challenging. An essential criterion for the understanding of an SQL statement is not only a clear structure and formatting of the statement, but also whether the statement is compact enough to get the major task on a short glance at the statement.<\/p>\n<p>When using a high resolution and common editor font settings a maximum of 40 lines of SQL code are visible on a common monitor in SSMS. Most developers, however, will have only 25 lines code on the screen.<\/p>\n<p>There are developers that insert blank lines after each line of code. An excessive use of blank lines requires the reader of a statement to use navigation keys or the mouse wheel to be able to read the complete statement.<\/p>\n<p>Blank lines can be a good stylistic means of separating logical blocks. Excessive use, however, makes a statement harder to read.<\/p>\n<h2><a style=\"font-size: inherit;\" name=\"H2_04\"><\/a><strong style=\"font-size: inherit;\">The Semicolon<\/strong><\/h2>\n<p>According to standard SQL all SQL statements must be terminated with a semicolon. At least SQL Server does not force the programmer to use the semicolon.<\/p>\n<p>There are only a few cases where the use of a semicolon is mandatory. For example, when using a Common Table Expression (starting with the keyword WITH), the preceding statement must be terminated with a semicolon.<\/p>\n<p>In any case, using the semicolon is not only a matter of improving the readability of an SQL statement. It may help migrating an existing database application to a database of another provider.<\/p>\n<p>And finally, using semicolons proves the developer to be accurate.<\/p>\n<h2><a name=\"H2_05\"><\/a><strong>The Comma<\/strong><\/h2>\n<p>In an SQL statement a list of field names must be separated by a comma. When writing field names with each other you can prefix or suffix the field names with a comma. The pros and cons usually concentrate on the philosophic question how difficult it is to add a new field to the field list.<\/p>\n<p><span style=\"font-size: inherit;\">The most important reasons for prefixing field names are an improved readability on the one hand and a possible usage of the column editor feature on the other hand (see also <\/span><a style=\"font-size: inherit;\" href=\"https:\/\/staging.sql.marcus-belz.de\/?p=143\" target=\"_blank\" rel=\"noopener noreferrer\">Functional Design (Aesthetics) of SQL<\/a><span style=\"font-size: inherit;\">).<\/span><\/p>\n<h3><strong>Prefixing field names<\/strong><\/h3>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080007.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-391 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080007.png\" alt=\"\" width=\"221\" height=\"80\"><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=392\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>Let\u2019s assume that we want to add the field name <strong>FrenchDayNameOfWeek<\/strong> to the list of field names. Obviously, it appears to be easier to add the field at the end of the list. You just insert the following line<\/p>\n<pre style=\"padding-left: 30px;\">,[FrenchDayNameOfWeek]<\/pre>\n<p>behind the field <strong>SpanishDayNameOfWeek<\/strong>:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080008.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-393 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080008.png\" alt=\"\" width=\"215\" height=\"96\"><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=394\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>In opposite, when inserting the field at position one \u2013 before the field EnglishDayNameOfWeek&nbsp; \u2013 two modifications are required: Add the field name<\/p>\n<pre style=\"padding-left: 30px;\">[FrenchDayNameOfWeek]<\/pre>\n<p>at position one without a trailing comma and prefix the second field with a comma.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080009.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-395 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080009.png\" alt=\"\" width=\"223\" height=\"96\"><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=396\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<h3><strong>Suffixing field names<\/strong><\/h3>\n<p>When suffixing field names, the above arguments turn into the opposite: it is easier to add a new field at the beginning of a field list.<\/p>\n<h3><strong>Readability<\/strong><\/h3>\n<p>The comma is a separator. It marks the change from one field to the next. If the comma is written behind a field name, it loses its separating character due to the different lengths of the field names.<\/p>\n<p>In the following statement it is not immediately clear whether the identifier <strong>Alias<\/strong> is a field name or has a different meaning. The reader must read the line above the identifier <strong>Alias<\/strong> in order to determine that the identifier is to be read as an alias.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080010.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-397 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080010.png\" alt=\"\" width=\"230\" height=\"144\"><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=366\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>It is different with the comma written before field names. In this case, it is immediately obvious that the identifier <strong>Alias<\/strong> is not a field name because it has no preceding comma:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=363\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-363 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080011.png\" alt=\"\" width=\"234\" height=\"144\"><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=364\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<h3><strong>The comma and the column editor feature<\/strong><\/h3>\n<p>Have a look at the following statement. It appears to be quite challenging to add aliases to all field names.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080012.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-365 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080012.png\" alt=\"\" width=\"212\" height=\"128\"><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=366\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>Each comma must be moved to the right. Before the comma you must add the keyword <strong>AS<\/strong> and after the keyword <strong>AS<\/strong> you must enter the aliases. These actions must be done line by line. What an effort for adding 5 aliases.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080013.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-367 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080013.png\" alt=\"\" width=\"410\" height=\"128\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080013.png 410w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080013-300x94.png 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=368\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>You can minimize the effort involved by prefixing the field names with commas and aligning neatly. In that case you can take advantage of the column editor feature.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080014.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-369 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080014.png\" alt=\"\" width=\"415\" height=\"128\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080014.png 415w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080014-300x93.png 300w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=370\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>There are no commas to move. The column editor allows you to type the keyword <strong>AS<\/strong> only once, the field names can be used as the base for the aliases. Copy the field names behind the keyword and use the column editor to prefix the aliases with the text Alias. And the best of all: The effort for this is largely independent of the number of lines to be processed.<\/p>\n<h2><a name=\"H2_06\"><\/a><strong>Function Names<\/strong><\/h2>\n<p>Function names are highlighted by pink letters in SSMS, making them easy to identify. Since not all editors use color highlighting of function names, function names should also be identified by a uniform notation: Function names should be written either only in capital letters or only in small letters.<\/p>\n<p>Microsoft itself \u2013 but also other database providers \u2013 note function names in capital letters in the online documentation. So, why deviate from the standard?<\/p>\n<h2><a style=\"font-size: inherit;\" name=\"H2_07\"><\/a><strong>Table<\/strong> <strong style=\"font-size: inherit;\">Aliases<\/strong><\/h2>\n<p>A common practice is to derive meaningful table aliases from the table name. For example, by writing the starting letters of the compound words of the table name. With that rule you can find for the table <strong>FactInternetSales<\/strong> the alias <strong>IS<\/strong>. The letters result from the first letters of the word components of the table name ignoring the prefix <strong>Fact<\/strong>. Since <strong>IS<\/strong> is a reserved word, this alias must be wrapped with delimiters. For other tables, the following aliases could be derived:<\/p>\n<table style=\"margin-left: 30px;\">\n<tbody style=\"padding-left: 35px;\">\n<tr style=\"padding-left: 30px;\">\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">DimCustomer<\/td>\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">CUST<\/td>\n<\/tr>\n<tr style=\"padding-left: 30px;\">\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">DimProduct<\/td>\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">P<\/td>\n<\/tr>\n<tr style=\"padding-left: 30px;\">\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">DimProductCategory<\/td>\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">PC<\/td>\n<\/tr>\n<tr style=\"padding-left: 30px;\">\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">DimProductSubcategory<\/td>\n<td style=\"padding-left: 35px; text-align: left;\" width=\"10\">PSC<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>A SELECT Statement using the above tables would look like as follows:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070015.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-339 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070015.png\" alt=\"\" width=\"472\" height=\"336\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070015.png 472w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070015-300x214.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=372\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>The varying indentation of the field names results from different lengths of the aliases. These have a length between 1 and 4 characters. The field list appears restless and can quickly become illegible with more complex statements and the use of other language elements (functions, CASE statements, etc.).<\/p>\n<p>Imagine a SELECT statement based on 20 or more tables. At some point it will be difficult finding meaningful aliases for table names. Aliases may then appear too cryptic.<\/p>\n<p>My personal view on meaningful aliases is that these aliases do not really improve the readability of a statement.<\/p>\n<p>Wouldn\u2019t it be easier to identify systematic \u2013 perhaps even indexed aliases \u2013 in a complex statement?<\/p>\n<p>Systematic aliases could be defined as follows:<\/p>\n<ul>\n<li>The length of aliases is being limited to a fixed number of characters<\/li>\n<li>Aliases names are indexed<\/li>\n<\/ul>\n<p>For example, using the letter <strong>T<\/strong> for <strong>tables<\/strong> as an alias (or <strong>F<\/strong> for <strong>fact table<\/strong>, <strong>D<\/strong> for <strong>dimension<\/strong>, etc.) followed by a 2-digit 1-based index with trailing zeroes, aliases would result to <strong>T01<\/strong>, <strong>T02<\/strong>, <strong>D01<\/strong>, <strong>F01<\/strong>, etc.<\/p>\n<p>Using those aliases, the above statement appears more readable:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070016.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-344 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070016.png\" alt=\"\" width=\"472\" height=\"336\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070016.png 472w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070016-300x214.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=374\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>The field names within the SELECT list are neatly aligned.<\/p>\n<p>However, the actual killer argument is also here: the notation of fixed length aliases allows the use of the power feature column editor.<\/p>\n<p>In addition to this argument, there is another important reason why to use aliases: Only by using aliases, the Intellisense feature can be used efficiently. If the developer writes an alias followed by a dot, then a context menu opens showing only the field names associated with the alias:<\/p>\n<p>The context menu can \u2013 if the cursor is behind the dot \u2013 also be open manually by using the shortcut <strong>CTRL+space<\/strong>. Of course, the context menu can also be used without the context of the preceding alias. However, SSMS then offers the entire vocabulary of T-SQL in the context menu.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070017.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-346 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070017.png\" alt=\"\" width=\"480\" height=\"214\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070017.png 480w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00070017-300x134.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><\/p>\n<p>Aliases make SQL code more readable and thus maintainable. Therefore, using aliases should be mandatory.<\/p>\n<h3><a name=\"H2_08\"><\/a><strong>Qualified Field Names<\/strong><\/h3>\n<p>If a statement covers multiple tables, you will be facing a situation where the same field name is available in more than one table. The following statement wants to return the names and phone numbers of both the employee and the reseller:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080018.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-376 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080018.png\" alt=\"\" width=\"357\" height=\"240\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080018.png 357w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080018-300x202.png 300w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=377\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>The statement is not executable because the field <strong>Phone<\/strong> exists in both dimensions <strong>DimEmployee<\/strong> and <strong>DimReseller<\/strong>. SQL Server throws two ambiguous column exceptions. Specifying an alias is mandatory here.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080020.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-380 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080020.png\" alt=\"\" width=\"321\" height=\"70\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080020.png 321w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080020-300x65.png 300w\" sizes=\"auto, (max-width: 321px) 100vw, 321px\" \/><\/a><\/p>\n<p>When defining an alias, then the developer must qualify a field name with that alias.<\/p>\n<pre style=\"padding-left: 40px;\">T01.[Phone] AS [Employee_Phone]<\/pre>\n<p>Using aliases means, that you use qualified names for an object. Another example for a qualified field name is prefixing the field name with the table name:<\/p>\n<pre style=\"padding-left: 40px;\">[DimEmployee].[Phone] AS [Employee_Phone]<\/pre>\n<p>.<\/p>\n<p>This option, however, does not really improve the readability of a statement.<\/p>\n<p>A fully qualified field name consists of 5 parts:<\/p>\n<pre style=\"padding-left: 30px;\">[Server].[Database].[Schema].[Table].[Column]<\/pre>\n<p>n example for almost fully qualified object names you will find in the following statement:<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080019.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-378 size-full\" src=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080019.png\" alt=\"\" width=\"462\" height=\"240\" srcset=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080019.png 462w, https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post00080019-300x156.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/staging.sql.marcus-belz.de\/?attachment_id=379\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/p>\n<p>Qualifying an object beyond the schema name prevents a database application from being deployable in a database with a different name.<\/p>\n<p>After all, using aliases should be mandatory at all, but be aware of the portability of a database application. Do not qualify object names beyond the schema unless there is a good reason for this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dieser Artikel in Deutsch&#8230; Overview Capital letters are often used to emphasize single words. This applies, for example, to German as a language. Latin, Greek, &#8230; Although there are languages that do distinct between upper and lower case (with respect to nouns), it has nevertheless prevailed in most languages. Even in English you can sometimes &#8230; <a title=\"Formatting SQL Statements (Part 1)\" class=\"read-more\" href=\"https:\/\/staging.sql.marcus-belz.de\/?p=358&#038;lang=en\" aria-label=\"Mehr Informationen \u00fcber Formatting SQL Statements (Part 1)\">Weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106,108],"tags":[148,150,152,134],"class_list":["post-358","post","type-post","status-publish","format-standard","hentry","category-all-languages-en","category-english-en","tag-column-editor-en","tag-format-en","tag-naming-convention-en","tag-t-sql-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Formatting SQL Statements (Part 1) - Just another SQL blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Formatting SQL Statements (Part 1) - Just another SQL blog\" \/>\n<meta property=\"og:description\" content=\"Dieser Artikel in Deutsch&#8230; Overview Capital letters are often used to emphasize single words. This applies, for example, to German as a language. Latin, Greek, &#8230; Although there are languages that do distinct between upper and lower case (with respect to nouns), it has nevertheless prevailed in most languages. Even in English you can sometimes ... Weiterlesen\" \/>\n<meta property=\"og:url\" content=\"https:\/\/staging.sql.marcus-belz.de\/?p=358&amp;lang=en\" \/>\n<meta property=\"og:site_name\" content=\"Just another SQL blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-31T15:38:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-06T23:06:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png\" \/>\n<meta name=\"author\" content=\"marcus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Geschrieben von\" \/>\n\t<meta name=\"twitter:data1\" content=\"marcus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"12\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en\"},\"author\":{\"name\":\"marcus\",\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/#\\\/schema\\\/person\\\/98ab042e47d7286f64530ee18f20f675\"},\"headline\":\"Formatting SQL Statements (Part 1)\",\"datePublished\":\"2018-05-31T15:38:59+00:00\",\"dateModified\":\"2026-05-06T23:06:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en\"},\"wordCount\":2446,\"image\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/post0008001.png\",\"keywords\":[\"Column Editor\",\"Format\",\"Naming Convention\",\"T-SQL\"],\"articleSection\":[\"All Languages\",\"English\"],\"inLanguage\":\"de\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en\",\"url\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en\",\"name\":\"Formatting SQL Statements (Part 1) - Just another SQL blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/post0008001.png\",\"datePublished\":\"2018-05-31T15:38:59+00:00\",\"dateModified\":\"2026-05-06T23:06:39+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/#\\\/schema\\\/person\\\/98ab042e47d7286f64530ee18f20f675\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en#primaryimage\",\"url\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/post0008001.png\",\"contentUrl\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/post0008001.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?p=358&lang=en#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Formatting SQL Statements (Part 1)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/#website\",\"url\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/\",\"name\":\"Just another SQL blog\",\"description\":\"Marcus Belz \u00b7 SQL Server \u00b7 ETL \u00b7 Datenqualit\u00e4t\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/#\\\/schema\\\/person\\\/98ab042e47d7286f64530ee18f20f675\",\"name\":\"marcus\",\"url\":\"https:\\\/\\\/staging.sql.marcus-belz.de\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Formatting SQL Statements (Part 1) - Just another SQL blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en","og_locale":"de_DE","og_type":"article","og_title":"Formatting SQL Statements (Part 1) - Just another SQL blog","og_description":"Dieser Artikel in Deutsch&#8230; Overview Capital letters are often used to emphasize single words. This applies, for example, to German as a language. Latin, Greek, &#8230; Although there are languages that do distinct between upper and lower case (with respect to nouns), it has nevertheless prevailed in most languages. Even in English you can sometimes ... Weiterlesen","og_url":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en","og_site_name":"Just another SQL blog","article_published_time":"2018-05-31T15:38:59+00:00","article_modified_time":"2026-05-06T23:06:39+00:00","og_image":[{"url":"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png","type":"","width":"","height":""}],"author":"marcus","twitter_card":"summary_large_image","twitter_misc":{"Geschrieben von":"marcus","Gesch\u00e4tzte Lesezeit":"12\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en#article","isPartOf":{"@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en"},"author":{"name":"marcus","@id":"https:\/\/staging.sql.marcus-belz.de\/#\/schema\/person\/98ab042e47d7286f64530ee18f20f675"},"headline":"Formatting SQL Statements (Part 1)","datePublished":"2018-05-31T15:38:59+00:00","dateModified":"2026-05-06T23:06:39+00:00","mainEntityOfPage":{"@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en"},"wordCount":2446,"image":{"@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en#primaryimage"},"thumbnailUrl":"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png","keywords":["Column Editor","Format","Naming Convention","T-SQL"],"articleSection":["All Languages","English"],"inLanguage":"de"},{"@type":"WebPage","@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en","url":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en","name":"Formatting SQL Statements (Part 1) - Just another SQL blog","isPartOf":{"@id":"https:\/\/staging.sql.marcus-belz.de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en#primaryimage"},"image":{"@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en#primaryimage"},"thumbnailUrl":"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png","datePublished":"2018-05-31T15:38:59+00:00","dateModified":"2026-05-06T23:06:39+00:00","author":{"@id":"https:\/\/staging.sql.marcus-belz.de\/#\/schema\/person\/98ab042e47d7286f64530ee18f20f675"},"breadcrumb":{"@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en#primaryimage","url":"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png","contentUrl":"https:\/\/staging.sql.marcus-belz.de\/wp-content\/uploads\/2018\/05\/post0008001.png"},{"@type":"BreadcrumbList","@id":"https:\/\/staging.sql.marcus-belz.de\/?p=358&lang=en#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/staging.sql.marcus-belz.de\/"},{"@type":"ListItem","position":2,"name":"Formatting SQL Statements (Part 1)"}]},{"@type":"WebSite","@id":"https:\/\/staging.sql.marcus-belz.de\/#website","url":"https:\/\/staging.sql.marcus-belz.de\/","name":"Just another SQL blog","description":"Marcus Belz \u00b7 SQL Server \u00b7 ETL \u00b7 Datenqualit\u00e4t","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/staging.sql.marcus-belz.de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/staging.sql.marcus-belz.de\/#\/schema\/person\/98ab042e47d7286f64530ee18f20f675","name":"marcus","url":"https:\/\/staging.sql.marcus-belz.de\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=\/wp\/v2\/posts\/358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=358"}],"version-history":[{"count":9,"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=\/wp\/v2\/posts\/358\/revisions"}],"predecessor-version":[{"id":900,"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=\/wp\/v2\/posts\/358\/revisions\/900"}],"wp:attachment":[{"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.sql.marcus-belz.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}