×ðÁú¿­Ê±¹ÙÍøµÇ¼

mysqlÖÐcheckµÄ×÷ÓÃ

mysql ÖÐ check Ô¼Êø

MySQL ÖÐµÄ CHECK Ô¼ÊøÓÃÓÚÔÚ±íÖжÔÁлò±í´ïʽʩ¼Ó¸üÖØ´óµÄÏÞÖÆ£¬³ýÁËÊý¾ÝÀàÐÍºÍ NOT NULL Ô¼ÊøÖ®Íâ¡£

×÷ÓÃ

CHECK Ô¼ÊøÔÊÐíÊý¾Ý¿âÖÎÀíÔ±½ç˵Ìõ¼þ£¬ÒÔÈ·±£Áлò±í´ïʽµÄÖµÖª×ãÌض¨±ê×¼¡£ÕâÓÐÖúÓÚά»¤Êý¾ÝÍêÕûÐÔ£¬²¢±ÜÃâÒâÍâ»òÎÞЧµÄÊý¾Ý½øÈë±íÖС£

ʹÓ÷½·¨

CHECK Ô¼Êø¿ÉÒÔÔÚ½¨Éè±íʱÌí¼Ó£¬Ò²¿ÉÒÔÔÚÒÔºóʹÓà ALTER TABLE Óï¾äÌí¼Óµ½ÏÖÓбíÖС£ÆäÓï·¨ÈçÏ£º

CHECK (expression)

µÇ¼ºó¸´ÖÆ

ÆäÖÐ expression ÊDz¼¶û±í´ïʽ£¬ÆäЧ¹û±ØÐèΪ TRUE ²Å»ª²åÈë»ò¸üбíÖеÄÐС£ÀýÈ磬ÒÔÏ CHECK Ô¼ÊøÈ·±£ age ÁÐÖеÄÖµ´óÓÚ 0£º

CHECK (age > 0)

µÇ¼ºó¸´ÖÆ

Óŵã

ʹÓà CHECK Ô¼Êø¾ßÓÐÒÔÏÂÓŵ㣺

Ìá¸ßÊý¾ÝÍêÕûÐÔ£ºCHECK Ô¼ÊøÓÐÖúÓÚÈ·±£±íÖеÄÊý¾ÝÓÐÓÃÇÒ׼ȷ¡£

ÏÞÖÆÎÞЧÊäÈ룺ËüÃÇ¿ÉÒÔ±ÜÃâÓëÔ¼ÊøÌõ¼þ²»Æ¥ÅäµÄÎÞЧÊý¾Ý½øÈë±íÖС£

Ìṩ¸üºÃµÄÐÔÄÜ£ºÍ¨¹ýÔÚÊý¾Ý¿â¼¶±ðʵÑéÔ¼Êø£¬MySQL ¿ÉÒÔ×èÖ¹¶ÔÎÞЧÊý¾Ý¾ÙÐÐÌÚ¹óµÄÅÌÎʺ͸üвÙ×÷¡£

¼ò»¯Ó¦ÓóÌÐòÂß¼­£ºCHECK Ô¼Êø¿ÉÒÔ½«Êý¾ÝÑéÖ¤Âß¼­´ÓÓ¦ÓóÌÐòתÒƵ½Êý¾Ý¿â£¬´Ó¶ø¼ò»¯Ó¦ÓóÌÐò´úÂë¡£

×¢ÖØÊÂÏî

ʹÓà CHECK Ô¼Êøʱ£¬ÐèҪעÖØÒÔÏÂÊÂÏ

ÐÔÄÜÓ°Ï죺ʹÓÃÖØ´óµÄ»òÉæ¼°¶à¸öÁÐµÄ CHECK Ô¼Êø¿ÉÄÜ»áÓ°ÏìÊý¾Ý¿âÐÔÄÜ¡£

²»ÊÊÓÃÓÚÐéÄâÁУºCHECK Ô¼Êø²»¿ÉÓ¦ÓÃÓÚÐéÄâÁУ¨×ÝÈ»Óà AS ×Ӿ佨ÉèµÄÁУ©¡£

´¥·¢Æ÷Ìæ»»¼Æ»®£ºÔÚijЩÇéÐÎÏ£¬´¥·¢Æ÷¿ÉÒÔ×÷Ϊ CHECK Ô¼ÊøµÄÌæ»»¼Æ»®£¬Ìṩ¸üÎÞаµÄÔ¼ÊøÑ¡Ïî¡£

ÒÔÉϾÍÊÇmysqlÖÐcheckµÄ×÷ÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ