mysqlÖвéÕÒ±í½á¹¹µÄÏÂÁîÊÇʲô
Òª²éÕÒ mysql ±íµÄ½á¹¹£¬¿ÉÒÔʹÓà describe ÏÂÁºó¸úÒª¼ì²éµÄ±íÃû¡£Êä³ö½«ÌṩÓйرíÖÐÿ¸öÁеÄÏêϸÐÅÏ¢£¬°üÀ¨Ãû³Æ¡¢Êý¾ÝÀàÐÍ¡¢¿É¿ÕÐÔ¡¢¼üÔ¼ÊøºÍĬÈÏÖµ¡£
MySQL ²éÕÒ±í½á¹¹µÄÏÂÁî
Òª²éÕÒ MySQL ±íµÄ½á¹¹£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
DESCRIBE table_name;
µÇ¼ºó¸´ÖÆ
ÆäÖÐ table_name ÊÇÄúÒª¼ì²éÆä½á¹¹µÄ±íµÄÃû³Æ¡£
Êä³ö˵Ã÷
´ËÏÂÁî»á·µ»ØÒ»¸öЧ¹û¼¯£¬ÆäÖаüÀ¨ÓйرíÖÐÿ¸öÁеÄÒÔÏÂÐÅÏ¢£º
Field: ÁеÄÃû³Æ
Type: ÁеÄÊý¾ÝÀàÐÍ
Null: Ö¸¶¨ÁÐÊÇ·ñÔÊÐí¿ÕÖµ
Key: Ö¸¶¨ÁÐÊÇ·ñÊÇÖ÷¼ü¡¢Íâ¼ü»òΨһ¼ü
Default: ÁеÄĬÈÏÖµ
Extra: ÆäËûÐÅÏ¢£¬ÀýÈç×Ô¶¯µÝÔöÁÐ
ʾÀý
¼ÙÉèÄúÓÐÒ»¸öÃûΪ customers µÄ±í£¬Æä½á¹¹ÈçÏ£º
CREATE TABLE customers ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, email VARCHAR(255) UNIQUE, phone_number VARCHAR(20) );
µÇ¼ºó¸´ÖÆ
ʹÓà DESCRIBE ÏÂÁîÅÌÎÊ customers ±íµÄ½á¹¹£¬Äú½«»ñµÃÒÔÏÂÊä³ö£º
Field Type Null Key Default Extra id int NO PRI NULL auto_increment name varchar(255) NO MUL NULL email varchar(255) NO UNI NULL phone_number varchar(20) YES MUL NULL
µÇ¼ºó¸´ÖÆ
´ËÊä³öÏÔʾ£º
±íÖÐÓÐËĸöÁУºid¡¢name¡¢email ºÍ phone_number¡£
id ÁÐÊÇÖ÷¼ü£¬×Ô¶¯µÝÔö¡£
name ºÍ email Áв»ÔÊÐí¿ÕÖµ¡£
email ÁоßÓÐΨһ¼üÔ¼Êø¡£
phone_number ÁÐÔÊÐí¿ÕÖµ¡£
ÒÔÉϾÍÊÇmysqlÖвéÕÒ±í½á¹¹µÄÏÂÁîÊÇʲôµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡