sqlÖÐwhereÓÃÀ´ÊµÏÖʲôÔËËã
where Óï¾äÓÃÓÚÔÚ sql ÅÌÎÊÖÐÌí¼Ó¹ýÂËÌõ¼þ£¬½öÑ¡ÔñÖª×ãÖ¸¶¨Ìõ¼þµÄ¼Í¼£¬Ó﷨Ϊ£ºselect ÁÐÃû from ±íÃû where Ìõ¼þ¡£where Óï¾äʹÓÃÖÖÖÖÌõ¼þ²Ù×÷·û£¬°üÀ¨£º=¡¢¡¢>¡¢>=¡¢
SQL ÖÐ WHERE Óï¾ä
ÔÚ SQL ÖУ¬WHERE Óï¾äÓÃÓÚÔÚÅÌÎÊÖÐÖ¸¶¨¹ýÂËÌõ¼þ£¬Ñ¡ÔñÖª×ãÌض¨Ìõ¼þµÄ¼Í¼¡£
WHERE Óï¾äµÄÓï·¨
SELECT ÁÐÃû FROM ±íÃû WHERE Ìõ¼þ
µÇ¼ºó¸´ÖÆ
Ìõ¼þ²Ù×÷·û
WHERE Óï¾äʹÓÃÖݪֲÙ×÷·ûÀ´Ö¸¶¨Ìõ¼þ£¬°üÀ¨£º
= ¼´ÊÇ
»ò != ²»¼´ÊÇ
> ´óÓÚ
>= ´óÓÚ»ò¼´ÊÇ
СÓÚ
СÓÚ»ò¼´ÊÇ
BETWEEN ½éÓÚ
LIKE Ä£ºýÆ¥Åä
IN ÊôÓÚ¸ø¶¨µÄÖµÁбí
ʾÀý
ÒÔÏÂÅÌÎÊʹÓà WHERE Óï¾äÑ¡Ôñ¿Í»§±íÖÐÄêËê´óÓÚ 25 ËêµÄ¿Í»§£º
SELECT * FROM customers WHERE age > 25;
µÇ¼ºó¸´ÖÆ
ʹÓÃÅþÁ¬·û
ÅþÁ¬·û£¨Èç AND¡¢OR¡¢NOT£©¿ÉÓÃÓÚ½«¶à¸öÌõ¼þ×éºÏµ½ WHERE Óï¾äÖС£
AND Ìõ¼þËùÓÐΪÕæʱ·µ»ØÕæ
OR Ìõ¼þÖÐÈκÎÒ»¸öΪÕæʱ·µ»ØÕæ
NOT ½«Ìõ¼þµÄЧ¹ûÈ¡·´
ʾÀý
ÒÔÏÂÅÌÎÊʹÓà AND ÅþÁ¬·ûÑ¡ÔñÄêËê´óÓÚ 25 ËêÇÒ¶¼»áΪ “ŦԼ” µÄ¿Í»§£º
SELECT * FROM customers WHERE age > 25 AND city = "New York";
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇsqlÖÐwhereÓÃÀ´ÊµÏÖʲôÔËËãµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡