Commit a56e2678 authored by Peter Eisentraut's avatar Peter Eisentraut

doc: Improve indentation of SQL examples

Some of these were indented using 8 spaces whereas the rest uses 4
spaces.  Probably originally some difference in tab size.
parent 7d7c9979
...@@ -1952,14 +1952,14 @@ SELECT <replaceable>select_list</replaceable> FROM <replaceable>table_expression ...@@ -1952,14 +1952,14 @@ SELECT <replaceable>select_list</replaceable> FROM <replaceable>table_expression
<programlisting> <programlisting>
WITH regional_sales AS ( WITH regional_sales AS (
SELECT region, SUM(amount) AS total_sales SELECT region, SUM(amount) AS total_sales
FROM orders FROM orders
GROUP BY region GROUP BY region
), top_regions AS ( ), top_regions AS (
SELECT region SELECT region
FROM regional_sales FROM regional_sales
WHERE total_sales &gt; (SELECT SUM(total_sales)/10 FROM regional_sales) WHERE total_sales &gt; (SELECT SUM(total_sales)/10 FROM regional_sales)
) )
SELECT region, SELECT region,
product, product,
SUM(quantity) AS product_units, SUM(quantity) AS product_units,
...@@ -2071,7 +2071,7 @@ WITH RECURSIVE included_parts(sub_part, part, quantity) AS ( ...@@ -2071,7 +2071,7 @@ WITH RECURSIVE included_parts(sub_part, part, quantity) AS (
SELECT p.sub_part, p.part, p.quantity SELECT p.sub_part, p.part, p.quantity
FROM included_parts pr, parts p FROM included_parts pr, parts p
WHERE p.part = pr.sub_part WHERE p.part = pr.sub_part
) )
SELECT sub_part, SUM(quantity) as total_quantity SELECT sub_part, SUM(quantity) as total_quantity
FROM included_parts FROM included_parts
GROUP BY sub_part GROUP BY sub_part
...@@ -2093,12 +2093,12 @@ GROUP BY sub_part ...@@ -2093,12 +2093,12 @@ GROUP BY sub_part
<programlisting> <programlisting>
WITH RECURSIVE search_graph(id, link, data, depth) AS ( WITH RECURSIVE search_graph(id, link, data, depth) AS (
SELECT g.id, g.link, g.data, 1 SELECT g.id, g.link, g.data, 1
FROM graph g FROM graph g
UNION ALL UNION ALL
SELECT g.id, g.link, g.data, sg.depth + 1 SELECT g.id, g.link, g.data, sg.depth + 1
FROM graph g, search_graph sg FROM graph g, search_graph sg
WHERE g.id = sg.link WHERE g.id = sg.link
) )
SELECT * FROM search_graph; SELECT * FROM search_graph;
</programlisting> </programlisting>
...@@ -2112,16 +2112,16 @@ SELECT * FROM search_graph; ...@@ -2112,16 +2112,16 @@ SELECT * FROM search_graph;
<programlisting> <programlisting>
WITH RECURSIVE search_graph(id, link, data, depth, path, cycle) AS ( WITH RECURSIVE search_graph(id, link, data, depth, path, cycle) AS (
SELECT g.id, g.link, g.data, 1, SELECT g.id, g.link, g.data, 1,
ARRAY[g.id], ARRAY[g.id],
false false
FROM graph g FROM graph g
UNION ALL UNION ALL
SELECT g.id, g.link, g.data, sg.depth + 1, SELECT g.id, g.link, g.data, sg.depth + 1,
path || g.id, path || g.id,
g.id = ANY(path) g.id = ANY(path)
FROM graph g, search_graph sg FROM graph g, search_graph sg
WHERE g.id = sg.link AND NOT cycle WHERE g.id = sg.link AND NOT cycle
) )
SELECT * FROM search_graph; SELECT * FROM search_graph;
</programlisting> </programlisting>
...@@ -2137,16 +2137,16 @@ SELECT * FROM search_graph; ...@@ -2137,16 +2137,16 @@ SELECT * FROM search_graph;
<programlisting> <programlisting>
WITH RECURSIVE search_graph(id, link, data, depth, path, cycle) AS ( WITH RECURSIVE search_graph(id, link, data, depth, path, cycle) AS (
SELECT g.id, g.link, g.data, 1, SELECT g.id, g.link, g.data, 1,
ARRAY[ROW(g.f1, g.f2)], ARRAY[ROW(g.f1, g.f2)],
false false
FROM graph g FROM graph g
UNION ALL UNION ALL
SELECT g.id, g.link, g.data, sg.depth + 1, SELECT g.id, g.link, g.data, sg.depth + 1,
path || ROW(g.f1, g.f2), path || ROW(g.f1, g.f2),
ROW(g.f1, g.f2) = ANY(path) ROW(g.f1, g.f2) = ANY(path)
FROM graph g, search_graph sg FROM graph g, search_graph sg
WHERE g.id = sg.link AND NOT cycle WHERE g.id = sg.link AND NOT cycle
) )
SELECT * FROM search_graph; SELECT * FROM search_graph;
</programlisting> </programlisting>
...@@ -2295,7 +2295,7 @@ WITH RECURSIVE included_parts(sub_part, part) AS ( ...@@ -2295,7 +2295,7 @@ WITH RECURSIVE included_parts(sub_part, part) AS (
SELECT p.sub_part, p.part SELECT p.sub_part, p.part
FROM included_parts pr, parts p FROM included_parts pr, parts p
WHERE p.part = pr.sub_part WHERE p.part = pr.sub_part
) )
DELETE FROM parts DELETE FROM parts
WHERE part IN (SELECT part FROM included_parts); WHERE part IN (SELECT part FROM included_parts);
</programlisting> </programlisting>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment