
Answer-first summary for fast verification
Answer: collect_set
The `collect_set` function in SQL is specifically used to aggregate values from a column into an array, ensuring that all elements within the array are unique. This is particularly useful in scenarios where you want to remove duplicate values from the result set. For instance, applying `collect_set` to a column with values ['new', 'active', 'new'] would yield ['new', 'active'], effectively removing the duplicate entry.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.