sqlÖÐfromµÄ×÷ÓÃ
sql ÖÐ from ×Ó¾äÓÃÓÚÖ¸¶¨ÅÌÎʵÄÊý¾ÝÔ´£¬°üÀ¨£ºÖ¸¶¨Ãü¾ÝÔ´£º½ç˵ҪÅÌÎʵıí»òÊÓͼ¡£ÅþÁ¬±í£ºÍ¨¹ý join Òªº¦×Ö½«¶à¸ö±íµÄÊý¾Ý×éºÏµ½ÅÌÎÊÖС£ÉèÖÃÅÌÎʹæÄ££º½ö¼ìË÷Ö¸¶¨±í»òÊÓͼÖеÄÊý¾Ý¡£
SQL ÖÐ FROM ×Ó¾äµÄ×÷ÓÃ
SQL ÖÐµÄ FROM ×Ó¾äÓÃÓÚÖ¸¶¨ÔÚÅÌÎÊÖÐÒª»ñÈ¡Êý¾ÝµÄ±í»òÊÓͼ¡£ËüÊÇÔÚ SELECT Óï¾äÖбØÐèµÄ£¬ÓÉÓÚËü½ç˵ÁËÊý¾ÝÔ´¡£
×÷Óãº
Ö¸¶¨Ãü¾ÝÔ´£ºFROM ×Ó¾äÖ¸¶¨ÒªÅÌÎʵıí»òÊÓͼµÄÃû³Æ¡£¿ÉÒÔÒ»´ÎÖ¸¶¨¶à¸öÊý¾ÝÔ´£¬ÒÔ±ã´ÓËüÃÇÖмìË÷Êý¾Ý¡£
ÅþÁ¬±í£ºFROM ×Ӿ仹¿ÉÒÔÓÃÓÚÅþÁ¬±í£¬¼´ÔÚÅÌÎÊÖÐ×éºÏ¶à¸ö±íµÄÊý¾Ý¡£Õâ¿ÉÒÔͨ¹ýʹÓà JOIN Òªº¦×ÖÀ´ÊµÏÖ¡£
ÉèÖÃÅÌÎʹæÄ££ºFROM ×Ó¾äÏÞÖÆÁËÅÌÎʵÄ×÷ÓÃÓò£¬½ö»ñÈ¡Ö¸¶¨±í»òÊÓͼÖеÄÊý¾Ý¡£
Óï·¨£º
SELECT column_list FROM table_name
µÇ¼ºó¸´ÖÆ
ÆäÖУº
column_list ÊÇÒª¼ìË÷µÄÁеÄÁÐ±í¡£
table_name ÊÇÒªÅÌÎʵıí»òÊÓͼµÄÃû³Æ¡£
ʾÀý£º
SELECT * FROM customers;
µÇ¼ºó¸´ÖÆ
´ËÅÌÎÊ´ÓÃûΪ “customers” µÄ±íÖмìË÷ËùÓÐÁС£
ÅþÁ¬±í£º
SELECT * FROM orders INNER JOIN products ON orders.product_id = products.id;
µÇ¼ºó¸´ÖÆ
´ËÅÌÎÊ´Ó “orders” ±íºÍ “products” ±íÖмìË÷Êý¾Ý£¬²¢Ê¹Óà ON ×Ó¾ä»ùÓÚ “product_id” ÁÐÅþÁ¬ÕâÁ½¸ö±í¡£
ÒÔÉϾÍÊÇsqlÖÐfromµÄ×÷ÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡