Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Friday, 16 February 2024

UPPER Function in MARIADB

In MariaDB, the UPPER() function is used to convert a string to uppercase. Here's the syntax:

UPPER(string)

Where string is the string expression that you want to convert to uppercase.

Here's an example of using the UPPER() function in MariaDB:

Suppose you have a table named employees with a column named first_name, and you want to retrieve all the first names in uppercase:

SELECT UPPER(first_name) AS upper_first_name

FROM employees;

This query will return all the first names from the employees table in uppercase.

You can also use the UPPER() function in combination with other SQL statements. For example, to filter records based on uppercase comparisons:

SELECT *

FROM employees

WHERE UPPER(first_name) = 'JOHN';

This query will retrieve all records from the employees table where the first_name is 'John', 'JOHN', 'john', etc., because the comparison is case-insensitive after converting the first_name to uppercase using the UPPER() function.

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.