×ðÁú¿­Ê±

mysqlÖÐfieldÊÇʲôÒâ˼

mysql ÖÐ field Òªº¦×ÖÓÃÓÚÔÚ±íÖвéÕÒÁеÄÐòºÅ£¬Í¨¹ýÖ¸¶¨±í´ïʽºÍÒª½ÏÁ¿µÄÁÐÃû£¬¼´¿É·µ»ØÆ¥ÅäÁеÄË÷Òý£¬²»È»·µ»Ø 0 »ò null£¬³£ÓÃÓÚ¶¯Ì¬ sql ºÍÈ·¶¨ÁÐ˳Ðò¡£

MySQL ÖÐµÄ FIELD

FIELD ÊÇ MySQL ÖеÄÒ»¸öÒªº¦×Ö£¬ÓÃÓÚÔÚ SELECT Óï¾äÖмìË÷±íÖÐÁеÄÐòºÅ£¨Ë÷Òý£©¡£

ÓÃ;

·µ»ØÖ¸¶¨ÁÐÔÚ±íÖеÄË÷Òý¡£

È·¶¨ÁÐÔÚ±íÖеÄλÖá£

ÓÃÓÚ¶¯Ì¬ SQL Óï¾äÖУ¬ÆäÖÐÐèҪƾ֤Ìõ¼þÒýÓÃÌض¨µÄÁС£

Óï·¨

FIELD(expr, col1, col2, ..., coln)

µÇ¼ºó¸´ÖÆ

ÆäÖУº

expr ÊÇÒª¼ìË÷ÆäË÷ÒýµÄ±í´ïʽ»òÁÐÃû¡£

col1, col2, …, coln ÊÇÓÃÓÚÈ·¶¨Ë÷ÒýµÄÁÐÃûµÄÁбí¡£

ʾÀý

ÔÚÃûΪ “employees” µÄ±íÖУ¬»ñÈ¡ “last_name” ÁеÄË÷Òý£º

SELECT FIELD('Smith', last_name) FROM employees;

µÇ¼ºó¸´ÖÆ

˵Ã÷

ÈôÊÇ expr ÓëÈκΠcoln Æ¥Å䣬Ôò·µ»ØÆäË÷Òý¡£

ÈôÊÇ expr ÓëÈκΠcoln ²»Æ¥Å䣬Ôò·µ»Ø 0¡£

ÈôÊÇ expr Ϊ NULL£¬Ôò·µ»Ø NULL¡£

Óŵã

ÔÚ±àд¶¯Ì¬ SQL Óï¾äʱºÜÓÐÓã¬ÕâЩÓï¾äÐèҪƾ֤Ìõ¼þÒýÓÃÌض¨ÁС£

¿ÉÒÔÓÃÀ´È·¶¨±íÖÐÁеÄ˳Ðò¡£

ÌṩÁËÒ»ÖÖ¼òÆÓµÄÒªÁìÀ´¼ìË÷ÁеÄË÷Òý£¬¶øÎÞÐèʹÓÃÖØ´óµÄ×ÓÅÌÎÊ»òÅþÁ¬¡£

×¢ÖØÊÂÏî

FIELD ²»¿ÉÓÃÓÚ GROUP BY »ò ORDER BY ×Ӿ䡣

FIELD »áµ¼ÖÂÌØÁíÍâÊý¾Ý´¦Öóͷ£¿ªÏú£¬Òò´ËÔÚÐèÒª¸ßÐÔÄܵÄÅÌÎÊÖÐÓ¦ÉóÉ÷ʹÓá£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿