Tuesday 2 August 2016

UPPER and LOWER functions



UPPER(string): It takes a string and convert all the characters to uppercase.
             
LOWER(string): It takes a string and convert all the characters to lowercase.

mysql> SELECT * FROM employee;
+----+--------------+------------+------------+
| id | firstName    | lastName   | salary     |
+----+--------------+------------+------------+
|  1 | Hari Krishna | Gurram     |   12345.67 |
|  2 | Rama Devi    | Gurram     | 1234578.67 |
|  3 | Lakshmana    | Rao        | 9876543.67 |
|  4 | Rama         | Krishna    | 1234587.67 |
|  5 | Sowmya       | asd        | 1238745.67 |
|  6 | Jyotsna      | PS         |   76543.67 |
|  7 | Gireesh      | Amara      |   87698.00 |
|  8 | Sravani      | Nidamanuri |  987654.00 |
|  9 | Saranya      | Amara      | 1987654.00 |
+----+--------------+------------+------------+
9 rows in set (0.00 sec)

mysql> SELECT UPPER(firstName) FROM employee;
+------------------+
| UPPER(firstName) |
+------------------+
| HARI KRISHNA     |
| RAMA DEVI        |
| LAKSHMANA        |
| RAMA             |
| SOWMYA           |
| JYOTSNA          |
| GIREESH          |
| SRAVANI          |
| SARANYA          |
+------------------+
9 rows in set (0.01 sec)

mysql> SELECT LOWER(firstName) FROM employee;
+------------------+
| LOWER(firstName) |
+------------------+
| hari krishna     |
| rama devi        |
| lakshmana        |
| rama             |
| sowmya           |
| jyotsna          |
| gireesh          |
| sravani          |
| saranya          |
+------------------+
9 rows in set (0.00 sec)



Previous                                                 Next                                                 Home

No comments:

Post a Comment