sql server2005Êý¾Ý¿â¼ÓÃÜ - MS-SQL Server / »ù´¡Àà
×öÁËÒ»¸ö¹ÜÀí³ÌÐò
ÏëÈÃÊý¾Ý¿âÓиöÃÜÂë
Ö»ÓÐÊäÈëÃÜÂë²ÅÄܽøÈëÊý¾Ý¿âÖÐ
½øÐÐÐ޸ģ¬
µÚÒ»´Î×öÊý¾Ý¿â£¬ÇëÎÊ´ó¼ÒÈçºÎ¸øÊý¾Ý¿â»òÕß
ÆäÖеıíÉèÖÃÃÜÂ룬ÒÔ·À±ðÈ˵ǽ
1Â¥µÄÄÜÏêϸЩÂð£¿
ûÓп´¶®
º¹ ²»ÊÇÓÀÉú¸çµÄÒâ˼°É
Â¥Ö÷²»±Ø×ö³ÌÐòµÄ£¬sql×Ô´ø·þÎñÆ÷½ÇÉ«ºÍÊý¾Ý¿â½ÇÉ«£¬Äã¿ÉÒÔÌí¼Ó¸öÓû§£¬ÔÚ·þÎñÆ÷½ÇÉ«ÀïÄÜ¿ØÖÆËûÃǶԱí²Ù×÷µÄȨÏÞ
Ïà¹ØÎÊ´ð£º
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
¿ÉÄÜÒòΪ¹¤×÷µÄÔÒò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......
ÕâÀïÏëÁ˽âÏ£¬¹ØÓÚSQL ServerÖзÖÒ³ºÍOracleÖзÖÒ³£»
ƽ³£Ð´Ó¦ÓóÌÐòµÄʱºò£¬±ÈÈçÓõÄÓïÑÔÊÇJava£¬ÓиöÁбíÒ³Ã棬ÐèÒª¶ÔÊý¾Ý·ÖÒ³ÏÔʾ£»
ÕâÀïÒª·ÖÒ³ÄѵÀ²»ÐèÒª½èÖúJava£¬¶øÖ±½ÓsqlÄÜÖªµÀ·ÖÒ³Âð£¬ÆðÂëÒ²Òª´«¸öÒ³Âë½ ......
select o_customer,o_price from orders having o_price >=avg(o_price)
select o_customer,o_price from orders where o_price >=(select avg(o_price) from orders)
ÎҸоõûÓÐÇø±ð°¡£¬ÔõôÔÚmysql»áÓÐ ......
ÎÒµÄ×÷ÒµÊÇÿ·ÖÖÓÖ´ÐÐÒ»´Î
ʱ¼ä³¤ÁË»áºÜ´óÂð£¿Ó°ÏìsqlµÄÔËÐÐÂð£¿
ÓÐʲôÓÅ»¯°ì·¨Âð£¿
-- ÄÇÒª¿´ÄãÊÇʲôÑùµÄ×÷ÒµÂÔÚÓÅ»¯µÄͬʱÄÜ·ñÂú×ãÄãµÄ¾ßÌåÐèÇóÂ
-- ¾¡ÎÊһЩ¹ÖÎÊÌ⣬ҲÀµµÃ°ÑÎÊÌâ˵¾ßÌåÒ»µã£¬µ±È˼ ......