NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

-- SQL String Functions Practice
mysql> set @text = 'my name is shafi mohiddin shaik';
Query OK, 0 rows affected (0.00 sec)

mysql> select upper(@text);
+---------------------------------+
| upper(@text) |
+---------------------------------+
| MY NAME IS SHAFI MOHIDDIN SHAIK |
+---------------------------------+
1 row in set (0.00 sec)

mysql> select lower(@text);
+---------------------------------+
| lower(@text) |
+---------------------------------+
| my name is shafi mohiddin shaik |
+---------------------------------+
1 row in set (0.00 sec)

mysql> select left(@text, 6);
+----------------+
| left(@text, 6) |
+----------------+
| my nam |
+----------------+
1 row in set (0.00 sec)

mysql> select left(@text, 6,10);
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 ',10)' at line 1
mysql> select left(@text, 6, 10);
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 ', 10)' at line 1
mysql> select right(@text, 6);
+-----------------+
| right(@text, 6) |
+-----------------+
| shaik |
+-----------------+
1 row in set (0.00 sec)

mysql> select right(@text, 7);
+-----------------+
| right(@text, 7) |
+-----------------+
| n shaik |
+-----------------+
1 row in set (0.00 sec)

mysql> select right(@text, 7);
+-----------------+
| right(@text, 7) |
+-----------------+
| n shaik |
+-----------------+
1 row in set (0.00 sec)

mysql> select char(@text);
+--------------------------+
| char(@text) |
+--------------------------+
| 0x00 |
+--------------------------+
1 row in set (0.00 sec)

mysql> select char_length(@text);
+--------------------+
| char_length(@text) |
+--------------------+
| 31 |
+--------------------+
1 row in set (0.00 sec)

mysql> select concat(@text, 'add','text');
+----------------------------------------+
| concat(@text, 'add','text') |
+----------------------------------------+
| my name is shafi mohiddin shaikaddtext |
+----------------------------------------+
1 row in set (0.00 sec)

mysql> select concat_ws('#', @text, 'add','text');
+------------------------------------------+
| concat_ws('#', @text, 'add','text') |
+------------------------------------------+
| my name is shafi mohiddin shaik#add#text |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select trim(@text)
-> ;
+---------------------------------+
| trim(@text) |
+---------------------------------+
| my name is shafi mohiddin shaik |
+---------------------------------+
1 row in set (0.00 sec)

mysql> select trim(both from @text);
+---------------------------------+
| trim(both from @text) |
+---------------------------------+
| my name is shafi mohiddin shaik |
+---------------------------------+
1 row in set (0.00 sec)

mysql> select reverse(@text);
+---------------------------------+
| reverse(@text) |
+---------------------------------+
| kiahs niddihom ifahs si eman ym |
+---------------------------------+
1 row in set (0.00 sec)

mysql> select replace (@text, 'a', '@')
-> ;
+---------------------------------+
| replace (@text, 'a', '@') |
+---------------------------------+
| my n@me is sh@fi mohiddin sh@ik |
+---------------------------------+
1 row in set (0.00 sec)

mysql> select repeat (@text, 4);
+------------------------------------------------------------------------------------------------------------------------------+
| repeat (@text, 4) |
+------------------------------------------------------------------------------------------------------------------------------+
| my name is shafi mohiddin shaikmy name is shafi mohiddin shaikmy name is shafi mohiddin shaikmy name is shafi mohiddin shaik |
+------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select repeat (@text , 4);
+------------------------------------------------------------------------------------------------------------------------------+
| repeat (@text , 4) |
+------------------------------------------------------------------------------------------------------------------------------+
| my name is shafi mohiddin shaikmy name is shafi mohiddin shaikmy name is shafi mohiddin shaikmy name is shafi mohiddin shaik |
+------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select bin(34);
+---------+
| bin(34) |
+---------+
| 100010 |
+---------+
1 row in set (0.01 sec)

mysql> select hex(34);
+---------+
| hex(34) |
+---------+
| 22 |
+---------+
1 row in set (0.01 sec)

mysql> select oct(34);
+---------+
| oct(34) |
+---------+
| 42 |
+---------+
1 row in set (0.00 sec)

mysql> select code('h');
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 '('h')' at line 1
mysql> select substring(@text, 4);
+------------------------------+
| substring(@text, 4) |
+------------------------------+
| name is shafi mohiddin shaik |
+------------------------------+
1 row in set (0.00 sec)

mysql> select substring(@text, 5);
+-----------------------------+
| substring(@text, 5) |
+-----------------------------+
| ame is shafi mohiddin shaik |
+-----------------------------+
1 row in set (0.00 sec)

mysql> select substring(@text, 5,6);
+-----------------------+
| substring(@text, 5,6) |
+-----------------------+
| ame is |
+-----------------------+
1 row in set (0.00 sec)

mysql> select substring(@text, 5,7);
+-----------------------+
| substring(@text, 5,7) |
+-----------------------+
| ame is |
+-----------------------+
1 row in set (0.00 sec)

mysql> select substring(@text, 5,8);
+-----------------------+
| substring(@text, 5,8) |
+-----------------------+
| ame is s |
+-----------------------+
1 row in set (0.00 sec)

mysql> select substring(@text, 5,-8);
+------------------------+
| substring(@text, 5,-8) |
+------------------------+
| |
+------------------------+
1 row in set (0.01 sec)

mysql> select substring(@text, -5,8);
+------------------------+
| substring(@text, -5,8) |
+------------------------+
| shaik |
+------------------------+
1 row in set (0.00 sec)

mysql> select substring(@text, -8,8);
+------------------------+
| substring(@text, -8,8) |
+------------------------+
| in shaik |
+------------------------+
1 row in set (0.00 sec)

mysql> select substring(@text, -13,8);
+-------------------------+
| substring(@text, -13,8) |
+-------------------------+
| ohiddin |
+-------------------------+
1 row in set (0.00 sec)

mysql> select substring_index(@text, '', 2)
-> ;
+-------------------------------+
| substring_index(@text, '', 2) |
+-------------------------------+
| |
+-------------------------------+
1 row in set (0.01 sec)

mysql> select substring_index(@text, ' ', 2)
-> ;
+--------------------------------+
| substring_index(@text, ' ', 2) |
+--------------------------------+
| my name |
+--------------------------------+
1 row in set (0.00 sec)

mysql> select substring_index(@text, ' ', 3)
-> ;
+--------------------------------+
| substring_index(@text, ' ', 3) |
+--------------------------------+
| my name is |
+--------------------------------+
1 row in set (0.00 sec)

mysql> select instr(@text, is);
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 'is)' at line 1
mysql> select instr(@text, 's');
+-------------------+
| instr(@text, 's') |
+-------------------+
| 10 |
+-------------------+
1 row in set (0.01 sec)

mysql> select instr(@text, 'is');
+--------------------+
| instr(@text, 'is') |
+--------------------+
| 9 |
+--------------------+
1 row in set (0.00 sec)

mysql> select insert(@text, 3,4,'AAA');
+--------------------------------+
| insert(@text, 3,4,'AAA') |
+--------------------------------+
| myAAAe is shafi mohiddin shaik |
+--------------------------------+
1 row in set (0.01 sec)

mysql> select insert(@text, 3,4,'A');
+------------------------------+
| insert(@text, 3,4,'A') |
+------------------------------+
| myAe is shafi mohiddin shaik |
+------------------------------+
1 row in set (0.00 sec)

mysql>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.