From the course: MySQL Essential Training

Unlock this course with a free trial

Join today to access over 24,300 courses taught by industry experts.

Case conversion

Case conversion

- Hi, I'm Bill Weinman. MySQL has a couple of simple functions for converting the case of strings. For this lesson, we use the scratch database. So I'll type in here, USE scratch. And I'm going to select the name column from the customer table. So I'll say SELECT name FROM customer. And there's our name column from the customer table. Now, perhaps I want them to all display in uppercase, so I can type in UPPER and use the upper function, which converts a string to uppercase. There's also an alias for the upper function called UCASE, which does exactly the same thing. It's actually an alias for the same thing. Likewise, there's LOWER and there is all lower case. And there is LCASE, which is an alias for lower, and we get exactly the same result. Now, what might be a practical use for this? Well, obviously if you want all your names displayed one way or another, or you want to return them all in a coherent case, that would be a reasonable purpose for it. But perhaps you're comparing…

Contents