I'm reviewing and learning SQL, there's something I notice that I find curious.
Suppose I have a table called
productos and one of its fields is
categoria , when I make the following queries I see that the result is the same:
SELECT DISTINCT categoria FROM productos;
SELECT categoria FROM productos GROUP BY categoria;
The difference I notice is that with
DISTINCT filters me the duplicates and respects the order in which they appear, while the sentence that uses
GROUP BY organizes them in alphabetical order. Based on that, can we say that the first sentence runs faster? If so, when handling large volumes of data, would the difference in performance be significant?