File: ex45.sql

package info (click to toggle)
pgformatter 5.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,964 kB
  • sloc: sql: 186,493; perl: 5,694; makefile: 2; sh: 1
file content (35 lines) | stat: -rw-r--r-- 769 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
WITH cte1 AS (
    SELECT
        *
    FROM
        table_a a
        -- Comment out or remove this JOIN to fix the indentation issue below
    INNER JOIN table_b b ON a.id = b.id
),
cte2 AS (
    SELECT
        CASE WHEN TRUE THEN
            TRUE
        WHEN NULL IS NULL
                OR TRUE = FALSE THEN
                NULL
                -- Indentation is off starting here
            WHEN FALSE
                AND TRUE THEN
                TRUE
            ELSE
                FALSE
            END AS value
        FROM
            cte1
            -- Indentation is correct after this line
)
SELECT
    *
FROM
    cte2;

SELECT *,
    SUM(( SELECT count(*) FROM b )) AS something, SUM(( SELECT count(*) FROM b )) AS something, a.b
    FROM
        a;