Friday, December 20, 2024

MySQL UPPER() Function

 The UPPER() function in MySQL is used to convert a given string to uppercase.

Syntax:

UPPER(string)
  • string: The string or column name you want to convert to uppercase.

Example:

SELECT UPPER('hello world');

This query will return:

HELLO WORLD

If you're using a column in a table, you can apply UPPER() like this:

SELECT UPPER(column_name) FROM table_name;

Example with a table:

Assume you have a table users with a column name:

SELECT UPPER(name) FROM users;

This will return all names in the name column in uppercase.

The UPPER() function is useful for case-insensitive comparisons or formatting data consistently.

No comments:

Post a Comment