ALL
ALL keeps duplicate result rows. It is the default behavior of a SELECT, so SELECT ALL and SELECT have the same meaning.
UNION ALL also preserves duplicates from both inputs. Use DISTINCT or UNION when duplicate rows should be removed.
Syntax
text
SELECT ALL expressions FROM source
query UNION ALL queryExamples
Retaining repeated values
sql
CREATE TABLE visits (country TEXT);
INSERT INTO visits VALUES ('GB'), ('GB'), ('FR');sql
SELECT ALL country
FROM visits
ORDER BY country
FORMAT csv;text
"FR"
"GB"
"GB"Appending query results
sql
SELECT 1 AS value
UNION ALL
SELECT 1
FORMAT csv;text
1
1ALL does not define an output order. Add a final ORDER BY when order matters.