mysqlÖÐÉó²é±íµÄÓï¾ä
mysql Ìṩ¶à·NÉó²é±íÐÅÏ¢µÄÕZ¾ä£ºÉó²é±í½Y˜‹£ºdescribe ±íÃûÉó²é±í”µ“þ£ºselect * from ±íÃûÉó²é±íÐÅÏ¢£ºshow table status like “±íÃû”Éó²é±íË÷Òý£ºshow index from ±íÃûÉó²é±í¼sÊø£ºshow create table ±íÃû
MySQL Éó²é±íÓï¾ä
MySQL ÌṩÁ˶àÖÖÓï¾äÀ´Éó²é¹ØÓÚ±íµÄÖÖÖÖÐÅÏ¢¡£ÆäÖÐ×î³£ÓõÄÓï¾äÈçÏ£º
1. Éó²é±í½á¹¹
DESCRIBE ;
µÇ¼ºó¸´ÖÆ
´ËÓï¾äÏÔʾ±íµÄÁÐÃû¡¢Êý¾ÝÀàÐÍ¡¢ÊÇ·ñÔÊÐí¿ÕÖµµÈÐÅÏ¢¡£
2. Éó²é±íÖеÄÊý¾Ý
SELECT * FROM ;
µÇ¼ºó¸´ÖÆ
´ËÓï¾äÏÔʾ±íÖÐËùÓÐÐеÄËùÓÐÁС£
3. Éó²é±íµÄÐÅÏ¢
SHOW TABLE STATUS LIKE "";
µÇ¼ºó¸´ÖÆ
´ËÓï¾äÏÔʾÓйرíµÄÖ÷ÒªÐÅÏ¢µÄÏêϸÐÅÏ¢£¬ÀýÈç±í¾Þϸ¡¢ÐÐÊý¡¢±íÒýÇæµÈ¡£
4. Éó²é±íË÷Òý
SHOW INDEX FROM ;
µÇ¼ºó¸´ÖÆ
´ËÓï¾äÏÔʾ±íÉϽ¨ÉèµÄËùÓÐË÷Òý¡£
5. Éó²é±íÔ¼Êø
SHOW CREATE TABLE ;
µÇ¼ºó¸´ÖÆ
´ËÓï¾äÏÔʾÓÃÓÚ½¨Éè±íµÄÍêÕû SQL Óï¾ä£¬°üÀ¨ËùÓÐÔ¼Êø¡£
ÕâЩÓï¾ä¿ÉÒÔ×ÊÖúÄúÏàʶ±íµÄ½á¹¹¡¢ÄÚÈݺÍÉèÖá£Í¨¹ýʹÓÃÕâЩÓï¾ä£¬Äú¿ÉÒÔ¸ú×ÙÊý¾Ý¿âÖÐµÄ±í²¢È·±£ÆäÕý³£ÔËÐС£
ÒÔÉϾÍÊÇmysqlÖÐÉó²é±íµÄÓï¾äµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡