0% found this document useful (0 votes)
12 views

String Func

Uploaded by

anushkaanand2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

String Func

Uploaded by

anushkaanand2021
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

string func

mysql> select length('Anushka');


+-------------------+
| length('Anushka') |
+-------------------+
| 7 |
+-------------------+
1 row in set (0.00 sec)

mysql> select bit_length('Anushka');


+-----------------------+
| bit_length('Anushka') |
+-----------------------+
| 56 |
+-----------------------+
1 row in set (0.02 sec)

mysql> select RPAD('Anushka',17,'?');


+------------------------+
| RPAD('Anushka',17,'?') |
+------------------------+
| Anushka?????????? |
+------------------------+
1 row in set (0.02 sec)

mysql> select LPAD('Anushka',17,'?');


+------------------------+
| LPAD('Anushka',17,'?') |
+------------------------+
| ??????????Anushka |
+------------------------+
1 row in set (0.02 sec)

mysql> select RTRIM('Red Alert ');


+----------------------+
| RTRIM('Red Alert ') |
+----------------------+
| Red Alert |
+----------------------+
1 row in set (0.00 sec)

mysql> select RTRIM(' Red Alert ');


+-----------------------------+
| RTRIM(' Red Alert ') |
+-----------------------------+
| Red Alert |
+-----------------------------+
1 row in set (0.00 sec)

mysql> select LTRIM(' Red Alert ');


+-----------------------------+
| LTRIM(' Red Alert ') |
+-----------------------------+
| Red Alert |
+-----------------------------+
1 row in set (0.00 sec)

mysql> select space(4);


+----------+
| space(4) |
+----------+
| |
+----------+
1 row in set (0.00 sec)

mysql> select lEFT('Anushka',4)


-> ;
+-------------------+
| lEFT('Anushka',4) |
+-------------------+
| Anus |
+-------------------+
1 row in set (0.02 sec)

mysql> select concat('Anushka'+'hot');


+-------------------------+
| concat('Anushka'+'hot') |
+-------------------------+
| 0 |
+-------------------------+
1 row in set, 2 warnings (0.00 sec)

mysql> select concat('Anushka''hot');


+------------------------+
| concat('Anushka''hot') |
+------------------------+
| Anushka'hot |
+------------------------+
1 row in set (0.00 sec)

mysql> select FIND_IN_SET('Anushka','My,jsdjshd,sjbcskjnds,anushka,sjbnfhsd'


);
+-----------------------------------------------------------------+
| FIND_IN_SET('Anushka','My,jsdjshd,sjbcskjnds,anushka,sjbnfhsd') |
+-----------------------------------------------------------------+
| 4 |
+-----------------------------------------------------------------+
1 row in set (0.02 sec)

mysql> select STRCMP('anushka','bvdhahjd');


+------------------------------+
| STRCMP('anushka','bvdhahjd') |
+------------------------------+
| -1 |
+------------------------------+
1 row in set (0.00 sec)

mysql> select replace('My name is Anand','Anand','Anushka');


+-----------------------------------------------+
| replace('My name is Anand','Anand','Anushka') |
+-----------------------------------------------+
| My name is Anushka |
+-----------------------------------------------+
1 row in set (0.00 sec)

mysql> select INSERT('My name is Anand',10,4,'Anushka');


+-------------------------------------------+
| INSERT('My name is Anand',10,4,'Anushka') |
+-------------------------------------------+
| My name iAnushkaand |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> select repeat


-> ('Anushka',12);
+----------------------------------------------------------------------------------
----+
| repeat
('Anushka',12)
|
+----------------------------------------------------------------------------------
----+
|
AnushkaAnushkaAnushkaAnushkaAnushkaAnushkaAnushkaAnushkaAnushkaAnushkaAnushkaAnushk
a |
+----------------------------------------------------------------------------------
----+
1 row in set (0.00 sec)

mysql> ('Anushka ',12);


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ''Anushka
',12)' at line 1
mysql> select repeat ('Anushka ',12);
+----------------------------------------------------------------------------------
----------------+
| repeat ('Anushka ',12)
|
+----------------------------------------------------------------------------------
----------------+
| Anushka Anushka Anushka Anushka Anushka Anushka Anushka Anushka Anushka Anushka
Anushka Anushka |
+----------------------------------------------------------------------------------
----------------+
1 row in set (0.00 sec)

mysql> select Reverse(Repeat('Anushka ',3));


+-------------------------------+
| Reverse(Repeat('Anushka ',3)) |
+-------------------------------+
| akhsunA akhsunA akhsunA |
+-------------------------------+
1 row in set (0.00 sec)

mysql> select UCASE('anushka');


+------------------+
| UCASE('anushka') |
+------------------+
| ANUSHKA |
+------------------+
1 row in set (0.00 sec)

mysql> select now;


ERROR 1054 (42S22): Unknown column 'now' in 'field list'
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:04 |
+---------------------+
1 row in set (0.02 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:10 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:13 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:14 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:15 |
+---------------------+
1 row in set (0.00 sec)

mysql>
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:16 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:17 |
+---------------------+
1 row in set (0.00 sec)

mysql>
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:18 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:19 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:20 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:21 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:22 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:23 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:24 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:25 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:25 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:26 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-07-30 10:49:26 |
+---------------------+
1 row in set (0.00 sec)

mysql> select Dayname(2024-07-30);


+---------------------+
| Dayname(2024-07-30) |
+---------------------+
| NULL |
+---------------------+
1 row in set, 1 warning (0.03 sec)

mysql> select DAYNAME(2024-07-30);


+---------------------+
| DAYNAME(2024-07-30) |
+---------------------+
| NULL |
+---------------------+
1 row in set, 1 warning (0.00 sec)

You might also like