डाउनलोड पी.डी.एफ. ई-बुक्स
SQL - CHARACTER_LENGTH

CHARACTER_LENGTH() Function दिए गए string की length को return करता है |

Syntax for CHARACTER_LENGTH() String SQL Function

CHARACTER_LENGTH(str)

Parameter :

str : यहाँ पर string दिया जाता है |


CHARACTER_LENGTH() और CHAR_LENGTH() ये दोनों एक जैसे functions है |


Example for CHARACTER_LENGTH() String Function in SQL

Source Code :
SELECT CHARACTER_LENGTH('Hello'),CHARACTER_LENGTH('Hii');
Output :
+---------------------------+-------------------------+
| CHARACTER_LENGTH('Hello') | CHARACTER_LENGTH('Hii') |
+---------------------------+-------------------------+
|                         5 |                       3 |
+---------------------------+-------------------------+

Another Example for CHARACTER_LENGTH() String Function in SQL

Sample Table

Table Name : Appliances
+----+----------+-----------------+-------+------+
| id | Dealer   | Appliances      | Cost  | GST  |
+----+----------+-----------------+-------+------+
|  1 | Ravikant | Washing Machine | 15000 | 4200 |
|  2 | Balaji   | T.V.            | 19000 | 3420 |
|  3 | Ravikant | Washing Machine | 15000 | 4200 |
|  4 | Electra  | Refrigerator    | 10000 | 2800 |
|  5 | K.K.     | Cooler          | 18000 | 5040 |
|  6 | Ganesh   | A.C.            | 35000 | 9800 |
|  7 | Rajaram  | Iron            |  1500 |  420 |
|  8 | Ravi     | Laptop          | 30000 | NULL |
+----+----------+-----------------+-------+------+

Source Code :
SELECT CHARACTER_LENGTH(Appliances) FROM Appliances;
Output :
+------------------------------+
| CHARACTER_LENGTH(Appliances) |
+------------------------------+
|                           15 | - Washing Machine
|                            4 | - T.V.
|                           15 | - Washing Machine
|                           12 | - Refrigerator
|                            6 | - Cooler
|                            4 | - A.C.
|                            4 | - Iron
|                            6 | - Laptop
+------------------------------+