in reply to Re^2: sql output format
in thread sql output format

chacham:

Thanks for that. I wasn't aware of the difference between UNION and UNION ALL. Hopefully, I'll remember it next time I need it.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^4: sql output format
by erix (Prior) on Oct 20, 2014 at 20:11 UTC

    lmgtfy, for

    PostgreSQL, Oracle, and SQLite.

    As chacham said, UNION ALL leaves the rowsets from all query-parts intact; UNION is slightly more expensive, as it makes the final rows DISTINCT (i.e., removes duplicates).

    With regard to these compound query operators, note that Oracle stubbornly uses MINUS instead of the Standard-prescribed EXCEPT. Ah well, I guess it's too late to teach them manners ;-)