mysqlÖеÄwhereÊÇʲôÒâ˼
where ×Ӿ䣬ÔÚ mysql ÖÐÓÃÓÚƾ֤Ìض¨Ìõ¼þɸѡÐС£1. ½á¹¹£ºselect from where 2. Ó÷¨£ºÖ¸¶¨É¸Ñ¡Ìõ¼þ£¬Ê¹ÓùØϵÔËËã·û½ÏÁ¿ÁÐÖµ¡¢³£Á¿»òÆäËûÁÐÖµ¡£3. ×÷Ó㺼ìË÷Ìض¨Ãü¾Ý£¬ïÔÌ´¦Àíʱ¼ä£¬ÓÅ»¯Êý¾Ý²Ù×÷ºÍ×éºÏÅÌÎÊ¡£
WHERE ×Ó¾äÔÚ MySQL ÖеļÄÒå
WHERE ×Ó¾äÊÇ MySQL ÖÐÓÃÓÚƾ֤Ìض¨Ìõ¼þ´Ó±íÖÐɸѡÐеÄÖ÷ÒªÒªº¦×Ö¡£ËüµÄÄ¿µÄÊÇ´ÓÖª×ã¸ø¶¨Ìõ¼þµÄÐÐÖвéÕÒÊý¾Ý¡£
½á¹¹
WHERE ×Ó¾ä°üÀ¨ÒÔϽṹ£º
SELECT <columns> FROM <table_name> WHERE <condition></condition></table_name></columns>
µÇ¼ºó¸´ÖÆ
ÆäÖУº
Ö¸¶¨Òª»ñÈ¡µÄÁÐ
Ö¸¶¨Òª´ÓÖÐɸѡÐеıí
Ö¸¶¨É¸Ñ¡Ìõ¼þ
ʹÓÃÒªÁì
WHERE ×Ó¾äͨ¹ýʹÓùØϵÔËËã·û£¨Èç =¡¢¡¢>¡¢=¡¢
SELECT * FROM customers WHERE name = 'John Doe';
µÇ¼ºó¸´ÖÆ
´ËÅÌÎʽ«´Ó customers ±íÖнöÑ¡Ôñ´øÓÐ name ÁÐÉèÖÃΪ “John Doe” µÄÐС£
×÷ÓÃ
WHERE ×Ó¾äͨ¹ýÒÔÏ·½·¨ÔÚ MySQL ÖÐÊ©Õ¹Òªº¦×÷Óãº
¼ìË÷Ìض¨Ãü¾Ý£º´Ó±íÖÐÑ¡ÔñÖª×ãÌض¨Ìõ¼þµÄÐС£
ïÔÌ´¦Àíʱ¼ä£ºÍ¨¹ýÖ»´¦ÀíÖª×ãÌõ¼þµÄÐУ¬Ìá¸ßÅÌÎÊЧÂÊ¡£
ÓÅ»¯Êý¾Ý²Ù×÷£ºÔÊÐíÔÚ¸üС¢²åÈë»òɾ³ý²Ù×÷ÖÐÏÞÖÆÊÜÓ°ÏìµÄÐС£
×éºÏÅÌÎÊ£ºÓëÆäËû×Ӿ䣨Èç JOIN¡¢ORDER BY£©Ò»ÆðʹÓã¬ÒÔ½¨Éè¸üÖØ´óµÄÅÌÎÊ¡£
Ôö²¹ÐÅÏ¢
WHERE ×Ó¾ä¿ÉÒÔͬʱ°üÀ¨¶à¸öÌõ¼þ£¬Ê¹Óà AND »ò OR ÔËËã·ûÅþÁ¬¡£
¹ØÓÚÎı¾Êý¾Ý£¬Ìõ¼þÐèÒªÓõ¥ÒýºÅÒýÆðÀ´¡£
WHERE ×Ó¾äͨ³£·ÅÔÚ FROM ×Ó¾äÖ®ºó£¬¶ÔЧ¹û¾ÙÐйýÂË¡£
ÒÔÉϾÍÊÇmysqlÖеÄwhereÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡