Convert the case of every value in a MySQL Column to uppercase

MySQLMySQLi Database

For this, use UPPER() on MySQL column. Let us first create a table −

mysql> create table DemoTable627 (Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,FirstName varchar(100));
Query OK, 0 rows affected (0.62 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable627(FirstName) values(UPPER('John'));
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable627(FirstName) values(UPPER('Sam'));
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable627(FirstName) values(UPPER('Mike'));
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable627(FirstName) values(UPPER('Carol'));
Query OK, 1 row affected (0.17 sec)
mysql> insert into DemoTable627(FirstName) values(UPPER('dAVID'));
Query OK, 1 row affected (0.70 sec)

Display all records from the table using select statement −

mysql> select *from DemoTable627;

This will produce the following output −

+----+-----------+
| Id | FirstName |
+----+-----------+
|  1 | JOHN      |
|  2 | SAM       |
|  3 | MIKE      |
|  4 | CAROL     |
|  5 | DAVID     |
+----+-----------+
5 rows in set (0.00 sec)
raja
Published on 23-Aug-2019 07:32:02
Advertisements