×ðÁú¿­Ê±¹ÙÍøµÇ¼

sqlÖÐfromÊÇʲôÒâ˼

from Òªº¦×ÖÓÃÓÚÖ¸¶¨ÒªÅÌÎʵÄÊý¾ÝȪԴ£¨¼´±í£©£¬ÆäÓ﷨Ϊ£ºfrom table_name£¬ÔÚ select Óï¾äÖÐÖ¸¶¨ÒªÅÌÎʵıí£»ÔÚ join ²Ù×÷ÖÐÖ¸¶¨ÒªÅþÁ¬µÄ±í£»ÔÚ×ÓÅÌÎÊÖÐÖ¸¶¨ÒªÅÌÎʵÄ×Ó±í¡£

SQL ÖÐµÄ FROM Òªº¦×Ö

FROM Òªº¦×ÖµÄ×÷ÓÃ

FROM Òªº¦×ÖÓÃÓÚÖ¸¶¨ÒªÅÌÎʵÄÊý¾ÝȪԴ£¬¼´´ÓÄĸö±íÖÐÌáÈ¡Êý¾Ý¡£

FROM Òªº¦×ÖµÄÓï·¨

FROM table_name

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬table_name ÊÇÒªÅÌÎʵıíÃû¡£

FROM Òªº¦×ÖµÄÓ÷¨

FROM Òªº¦×Öͨ³£ÓÃÔÚ SELECT Óï¾äÖУ¬ÓÃÓÚÖ¸¶¨ÒªÅÌÎʵıí¡£ÀýÈ磺

SELECT * FROM customers;

µÇ¼ºó¸´ÖÆ

´ËÅÌÎʽ«´ÓÃûΪ customers µÄ±íÖÐÑ¡ÔñËùÓÐÐкÍÁС£

JOIN ²Ù×÷ÖÐµÄ FROM Òªº¦×Ö

FROM Òªº¦×ÖÒ²¿ÉÒÔÓÃÔÚ JOIN ²Ù×÷ÖУ¬ÓÃÓÚÖ¸¶¨ÒªÅþÁ¬µÄ±í¡£ÀýÈ磺

SELECT * FROM customers
INNER JOIN orders ON customers.id = orders.customer_id;

µÇ¼ºó¸´ÖÆ

´ËÅÌÎʽ«ÅþÁ¬ customers ±íºÍ orders ±í£¬²¢½« customers ±íÖÐµÄ id ÁÐÓë orders ±íÖÐµÄ customer_id ö¾ÙÐÐÆ¥Åä¡£

×ÓÅÌÎÊÖÐµÄ FROM Òªº¦×Ö

FROM Òªº¦×ÖÒ²¿ÉÒÔÓÃÔÚ×ÓÅÌÎÊÖУ¬ÓÃÓÚÖ¸¶¨ÒªÅÌÎʵÄ×Ó±í¡£ÀýÈ磺

SELECT * FROM (
    SELECT * FROM customers
    WHERE city = 'New York'
);

µÇ¼ºó¸´ÖÆ

´ËÅÌÎʽ«´Ó customers ±íÖÐÑ¡ÔñËùÓÐÖª×ã city Áм´ÊÇ New York µÄÐС£

ÒÔÉϾÍÊÇsqlÖÐfromÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ