sqlÖÐʵÏÖÊý¾Ý¼ìË÷µÄÓï¾äÊÇ
sql ÓÃÓÚÊý¾Ý¼ìË÷µÄÓï¾äΪ select¡£Óï·¨°üÀ¨ select£¨Ö¸¶¨ÁУ©¡¢from£¨Ö¸¶¨±í£©¡¢where£¨Ö¸¶¨Ìõ¼þ£©¡£Ê¾Àý°üÀ¨¼ìË÷ËùÓÐѧÉúÐÕÃûºÍÄêËê¡¢¼ìË÷ÄêËê´óÓÚ 18 ËêµÄѧÉú¡¢¼ìË÷Ìض¨Ñ§ÉúµÄËùÓÐÐÅÏ¢¡£
SQL ÖÐÊý¾Ý¼ìË÷Óï¾ä
SQL ÖÐÓÃÓÚ¼ìË÷Êý¾ÝµÄÓï¾äÊÇ SELECT¡£
Óï·¨£º
SELECT FROM WHERE
µÇ¼ºó¸´ÖÆ
×é¼þ£º
SELECT£ºÖ¸¶¨Òª¼ìË÷µÄÁС£¿ÉÒÔʹÓÃÐǺŠ(*) ÌåÏÖÑ¡ÔñËùÓÐÁС£
FROM£ºÖ¸¶¨Òª´ÓÄĸö±íÖмìË÷Êý¾Ý¡£
WHERE£ºÖ¸¶¨¼ìË÷Ìõ¼þ£¬ÓÃÓÚ¹ýÂ˳öÇкÏÌõ¼þµÄÐС£
ʾÀý£º
¼ìË÷ѧÉú±íÖÐËùÓÐѧÉúµÄÐÕÃûºÍÄêË꣺
SELECT name, age FROM students
µÇ¼ºó¸´ÖÆ
¼ìË÷ÄêËê´óÓÚ 18 ËêµÄѧÉú£º
SELECT name, age FROM students WHERE age > 18
µÇ¼ºó¸´ÖÆ
¼ìË÷Ìض¨Ñ§ÉúµÄËùÓÐÐÅÏ¢£º
SELECT * FROM students WHERE name = "John Doe"
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇsqlÖÐʵÏÖÊý¾Ý¼ìË÷µÄÓï¾äÊǵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£