SQL - Taking TEXT data type in Min/Max

Hello! I am currently on the Aggregate Functions section of the SQL course for beginners. I was wondering, how does the MIN/MAX functions handle TEXT data types? For example, if I had a list of names:

Alex
Ariana
Cody
Zack

would MIN(names) return Alex and MAX(names) return “Zack”?

It’s one of those ones that’s always worth trying,

 SELECT MIN('Ariana', 'Alex', 'Cody', 'Zack');

Bear in mind that capitals would be sorted first (I think the sort is normally UTF-8 based but don’t quote me on that, I think it can vary based on install/database set-up).

2 Likes

Thanks so much! I tried it and you’re right, it is ordered based off alphabetical order but takes into account capital letters first.

2 Likes