¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 58°Ç
   
[MYSQL] ¹®ÀÚ¿­ ÀÚ¸£±â left, substring, right
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2014-05-16 (±Ý) 10:41 Á¶È¸ : 11379
±ÛÁÖ¼Ò :
                          

mysql> select product_name from TB_SVC where ip='XXX.XXX.XXX.XXX';
+------------------------------------------+
| product_name                             |
+------------------------------------------+
| Å×½ºÆ®ÁøÇà ºÎÇÏºÐ»ê ·Îµå¹ß¶õ¼­ (1 CORE ) |
+------------------------------------------+
1 row in set (0.00 sec)



1. ¿ÞÂÊ¿¡¼­ ¹®ÀÚ¿­ ÀÚ¸£±â
left(Ä÷³¸í ¶Ç´Â ¹®ÀÚ¿­, ¿ÞÂÊ¿¡¼­ Àß¶ó³¾ ¹®ÀÚ¿­ÀÇ ±æÀÌ)
mysql> select left(product_name,5) from TB_SVC where ip='XXX.XXX.XXX.XXX';
+----------------------+
| left(product_name,5) |
+----------------------+
| Å×½ºÆ®ÁøÇà           |
+----------------------+
1 row in set (0.00 sec)

 
2. Áß°£¿¡¼­ ¹®ÀÚ¿­ ÀÚ¸£±â
substring(Ä÷³ ¶Ç´Â ¹®ÀÚ¿­, ½ÃÀÛÀ§Ä¡, ±æÀÌ);
mysql> select substring(product_name,19,1) from TB_SVC where ip='XXX.XXX.XXX.XXX';
+------------------------------+
| substring(product_name,19,1) |
+------------------------------+
| 1                            |
+------------------------------+
1 row in set (0.00 sec)
¡Ø PHP ¿¡¼­ ¹®ÀÚ¿­ ÀÚ¸£±â ÇÔ¼ö´Â substr À̸ç, ½ÃÀÛÀ§Ä¡´Â 0¹øºÎÅÍ ½ÃÀÛ, substring´Â 1¹øºÎÅÍ ½ÃÀÛ
 

3. ¿À¸¥ÂÊ¿¡¼­ ¹®ÀÚ¿­ ÀÚ¸£±â
right(Ä÷³¸í ¶Ç´Â ¹®ÀÚ¿­, ±æÀÌ)
mysql> select right(product_name,9) from TB_SVC where ip='XXX.XXX.XXX.XXX';
+-----------------------+
| right(product_name,9) |
+-----------------------+
| (1 core )             |
+-----------------------+
1 row in set (0.00 sec)

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.