sqlÖÐfromµÄ×÷ÓÃÊÇʲô
from ×Ó¾äÔÚ sql ÖеÄ×÷ÓÃÊÇÖ¸¶¨Ãü¾ÝÔ´£¬°üÀ¨£º´ÓÒ»¸ö»ò¶à¸ö±íÖмìË÷Êý¾ÝÔÚ±íÖ®¼ä½¨Éè¹ØÁªÌõ¼þÍŽá where ×Ó¾ä¹ýÂËÊý¾Ý
SQL ÖÐ FROM ×Ó¾äµÄÓÃ;
ÔÚ SQL ÖУ¬FROM ×Ó¾äÓÃÓÚÖ¸¶¨Òª´ÓÖмìË÷Êý¾ÝµÄ±í»òÊÓͼ¡£ËüÊÇ SELECT Óï¾äÖбز»¿ÉÉÙµÄ×Ӿ䣬ÓÉÓÚËü½ç˵ÁËÊý¾ÝÔ´¡£
×÷ÓÃ
FROM ×Ó¾äµÄÖ÷Òª×÷ÓÃÊÇ£º
Ö¸¶¨Ãü¾ÝÔ´£ºËü¸æËß SQL Ú¹ÊÍÆ÷´ÓÄĸö±í»òÊÓͼ¼ìË÷Êý¾Ý¡£
´Ó¶à¸ö±íÖмìË÷Êý¾Ý£ºËüÔÊÐí´Ó¶à¸ö±íÖмìË÷Êý¾Ý£¬¾ÙÐÐÊý¾Ý¹ØÁªºÍÍŽᡣ
ÉèÖùØÁªÌõ¼þ£ºËü¿ÉÒÔÓë ON »ò USING ×Ó¾äÍŽáʹÓã¬ÒÔÔÚ¶à¸ö±íÖ®¼ä½¨Éè¹ØÁªÌõ¼þ¡£
¹ýÂËÊý¾Ý£ºµ± FROM ×Ó¾äÓë WHERE ×Ó¾äÍŽáʹÓÃʱ£¬Ëü¿ÉÒÔ¹ýÂËÀ´×ÔÊý¾ÝÔ´µÄÊý¾Ý£¬½ö·µ»ØÖª×ãÌض¨Ìõ¼þµÄÐС£
Óï·¨
FROM ×Ó¾äµÄÓï·¨ÈçÏ£º
FROM table_name [alias] [, table_name [alias]] ...
µÇ¼ºó¸´ÖÆ
table_name£ºÒª´ÓÖмìË÷Êý¾ÝµÄ±íµÄÃû³Æ¡£
alias£º¸ø±íµÄ¿ÉÑ¡ÓÖÃû£¬¿ÉÒÔ¼ò»¯±íÒýÓá£
ʾÀý
ÒÔÏÂʾÀý´ÓÃûΪ “customers” µÄ±íÖмìË÷ËùÓпͻ§Êý¾Ý£º
SELECT * FROM customers;
µÇ¼ºó¸´ÖÆ
ÒÔÏÂʾÀý´Ó “customers” ±íºÍ “orders” ±íÖмìË÷¿Í»§ºÍ¶©µ¥Êý¾Ý£¬²¢Ê¹ÓÃÓÖÃû “c” ºÍ “o”£º
SELECT * FROM customers c, orders o;
µÇ¼ºó¸´ÖÆ
×ܶøÑÔÖ®£¬FROM ×Ó¾äÊÇ SQL ÖÐÒ»¸öÒªº¦×Ӿ䣬ÓÃÓÚÖ¸¶¨Ãü¾ÝÔ´¡¢¹ØÁª±íºÍ¹ýÂËÊý¾Ý£¬´Ó¶ø´ÓÊý¾Ý¿âÖмìË÷ËùÐèµÄÊý¾Ý¡£
ÒÔÉϾÍÊÇsqlÖÐfromµÄ×÷ÓÃÊÇʲôµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡