Skip to content

Comments

feat: Improve SELECT DISTINCT formatting, #11

Open
antimirov wants to merge 1 commit intokufii:masterfrom
antimirov:feat/improve-select-distinct-formatting
Open

feat: Improve SELECT DISTINCT formatting, #11
antimirov wants to merge 1 commit intokufii:masterfrom
antimirov:feat/improve-select-distinct-formatting

Conversation

@antimirov
Copy link

@antimirov antimirov commented Nov 3, 2022

Improve SELECT DISTINCT formatting, making it clear that the DISTINCT affects all columns, not just the first one. An example SQL style guide - https://about.gitlab.com/handbook/business-technology/data-team/platform/sql-style-guide/

Unformatted code:

SELECT DISTINCT supplier_name, city FROM suppliers
WHERE supplier_id > 500
ORDER BY supplier_name ASC, city DESC;

Current behavior:

SELECT
  DISTINCT supplier_name,
  city
FROM
  suppliers
WHERE
  supplier_id > 500
ORDER BY
  supplier_name ASC,
  city DESC;

Suggested new behavior:

SELECT DISTINCT
  supplier_name,
  city
FROM
  suppliers
WHERE
  supplier_id > 500
ORDER BY
  supplier_name ASC,
  city DESC;

Notice, that even Github's markdown highlighter works better with the last example, marking SELECT DISTINCT as keywords. In the current behavior the pair DISTINCT supplier_name is shown in gray color.

…STINCT affects all columns, not just the first one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants