mysqlÖÐfromʲôÒâ˼
from ÊÇ mysql ÅÌÎÊÖеÄÒªº¦×Ö£¬ÓÃÓÚÖ¸¶¨Ãü¾ÝÔ´£¨±í»òÊÓͼ£©¡£ËüÔÚ select Óï¾äÖÐÓÃÓÚʶ±ð¼ÓÈëÅÌÎʵÄÊý¾Ý£¬È·±£Êý¾Ý·µ»ØÓëÖ¸¶¨Ãü¾ÝÔ´Ïà¹Ø¡£
MySQL ÖÐµÄ FROM
ÔÚ MySQL ÅÌÎÊÖУ¬FROM Òªº¦×ÖÓÃÓÚÖ¸¶¨Ãü¾ÝÔ´£¬¼´Òª´ÓÖмìË÷Êý¾ÝµÄ±í»òÊÓͼ¡£Ëü½ôËæÔÚ SELECT Óï¾äÖ®ºó£¬ÓÃÓÚʶ±ð¼ÓÈëÅÌÎʲÙ×÷µÄÊý¾Ý¡£
×÷Óãº
FROM Òªº¦×Ö¸æËß MySQL ´ÓÄĸö±í»òÊÓͼÖлñÈ¡Êý¾Ý¡£ËüÈ·±£ÅÌÎʽö·µ»ØÓëÖ¸¶¨Ãü¾ÝÔ´Ïà¹ØµÄÊý¾Ý¡£
Óï·¨£º
SELECT ... FROM table_name [AS alias] [JOIN ...] [WHERE ...]
µÇ¼ºó¸´ÖÆ
ÆäÖУº
table_name ÊÇÒª´ÓÖмìË÷Êý¾ÝµÄ±í»òÊÓͼµÄÃû³Æ¡£
AS alias£¨¿ÉÑ¡£©Îª±í»òÊÓͼָ¶¨Ò»¸öÌåÃû£¬ÒÔ±ãÔÚÅÌÎÊÖиüÇáËɵØÒýÓÃËü¡£
JOIN£¨¿ÉÑ¡£©ÓÃÓÚÅþÁ¬¶à¸ö±í»òÊÓͼÒÔ×éºÏÊý¾Ý¡£
WHERE£¨¿ÉÑ¡£©ÓÃÓÚÌí¼Ó¹ýÂËÌõ¼þ£¬ÏÞÖÆ·µ»ØµÄÐС£
ʾÀý£º
SELECT * FROM employees WHERE salary > 50000;
µÇ¼ºó¸´ÖÆ
Õâ¸öÅÌÎÊ´ÓÃûΪ employees µÄ±íÖÐÑ¡ÔñËùÓÐÐУ¬Ìõ¼þÊÇ salary ÁеÄÖµ´óÓÚ 50,000¡£
×¢ÖØ£º
FROM Òªº¦×ÖÊÇ SELECT Óï¾äµÄ±ØÐ貿·Ö£¬ÈôÊDz»Ö¸¶¨Ãü¾ÝÔ´£¬ÔòÅÌÎʽ«·µ»Ø¹ýʧ¡£
¿ÉÒÔÖ¸¶¨¶à¸öÊý¾ÝÔ´£¨Ê¹Óà JOIN£©£¬µ«Ã¿¸öÊý¾ÝÔ´±ØÐèÓÐΨһµÄÓÖÃû¡£
ÓÖÃû¹ØÓÚʹÅÌÎʸüÒ׶ÁºÍά»¤ºÜÊÇÓÐÓá£
ÒÔÉϾÍÊÇmysqlÖÐfromʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡