sqlѧϰ½øÐÐʱ
ÕâÁ½Ì춼ûÓкúÃѧϰ£¬½ñÌìÖÕÓÚËãͶÈëÁËЩ£¬ÓÉÓڿγ̵ĹØϵ£¬ÎÒµÄsqlÒ²ÊÇͬvbÒ»ÆðѧϰµÄ¡£ËäȻ֪µÀÌ°¶à½À²»À㬿ÉÊÇ°´ÕÕʵ¼ÊÇé¿ö£¬ÎÒÍêȫûÓÐÀíÓÉÅ×ÆúsqlµÄ¡£
×î½ü¶¼°Ñʱ¼äͶÈëµ½vbºÍÃæÏò¶ÔÏóÖУ¬sql½ñÌìºÃºÃ¸´Ï°ÁËÏ£¬´Ócreate database ¿ªÊ¼£¬create table£¬alter table £¬ add constraint …… check£¨£©£¬insert into……values£¨£©£¬insert …… select……union£¬½ñÍíÎÒ°ÑÕâЩ¶¼¸´Ï°ÁËÒ»±é£¬»¹ÓÐѧÁËһЩ»ù±¾µÄ²éѯ£¬Ê±¼ä¾ÍÒѾ¹ýÈ¥ÁË¡£¸Ð¾õ»¹Í¦³äʵµÄ£¬ËäÈ»ºÜ¼òµ¥£¬µ«ÊÇÒ²¾ÍÊÇÒòΪÕâÑùÎÒ²ÅÓмÌÐøÏÂÈ¥µÄÓÂÆøºÍÐÅÐÄ°¡£¬ÎÒÏàÐÅ£¬ÔÚÕâÁ½ÄêÀÎÒ»á°Ñ×Ô¼º´ÓÒ»ÎÞËùÖªµÄѧÉú±ä³ÉÒ»¸öºÏ¸ñµÄ³ÌÐòÔ±£¬Ö»ÊǼ°¸ñ£¬²»ÒªÇóÓÅÐ㣬ÒòΪÕâÊÇÎÒ½ñºóÂþ³¤µÄ×ßÑ°µÀ·¡£
½ñÌìÈ¥¶îÍâµÄÌýÁËc++µÄ¿Î£¬ÊÇÒÔÇ°ÀÏʦÉϵģ¬Î»ÖúÜÔ¶£¬Ã»Ìýµ½Ê²Ã´£¬µ«ÊÇËû¸øµÄcppÎļþÎÒ×ÐϸµÄ¿´ÁË¿´¡£ÊǺºÅµÒÁÎÊÌ⣬½²µÄÊǵݹéµÄÎÊÌ⣬ÎÒ¿´Á˺ܾòŰÑÔõôµÝ¹éµ÷Óøø¿´Çå³þ£¬µ«ÊÇÖ±µ½ÏÖÔÚ»¹²»ÄÜ˵ÍêÈ«ÕÆÎÕ¡£µÝ¹éÎÒÊǶ®ÁË£¬µ«ÊÇÄǸöËã·¨ÎÒûŪµÃ³¹µ×Ã÷°×¡£ÒÔÇ°ÌýµÄʱºò¾ÍÒÅÁôÏÂÀ´µÄÎÊÌ⣬ÏÖÔÚÓÖÊǶÔÎҵĿ¼ÑéÁË¡£²»¹ýÓÐÁ˵ã»ù´¡£¬ÎÒ»¹ÊǰѺ¯ÊýµÄµ÷Óøø¿´Çå³þÁËЩ¡£
µÚ¶þ¸öcppÎļþÊÇÓйØ++iºÍi++µÄ£¬×Ðϸ¹Û²ìÁËÔËÐнá¹û£¬ÎÒ·¢ÏÖ++i¾ÍÓ¦¸Ã¿´³Écout<<++i,Ò²¾ÍÊÇ˵iÊÇÏÈ×ÔÔöºó²Å°ÑÖµ´«¸øcoutº¯Êý£¬Ò²¾ÍÊÇÈç¹ûÒ»¿ªÊ¼i=0µÄ»°£¬++iµÄÖµ¾ÍÊǺÍÏÖÔÚµÄiÖµÒ»Ñù¶¼ÊÇ1ÁË¡£¶øi++¾ÍÓ¦¸Ã¿´³Écout<<i++£¬Ò²¾ÍÊÇ˵iÏÈ°ÑÖµ´«¸øcoutº¯Êýºó²Å×ÔÔö1µÄ¡£»¹ÊÇÈç¹ûÒ»¿ªÊ¼i=0µÄ»°£¬i++µÄÖµ¾ÍÊÇ0£¬¶øiÊÇ1 ¡£Õâ¾ÍÊÇ++iºÍi++µÄÇø±ðÁË¡£
ºÇºÇ£¬ÒÔÇ°Ò»Ö±¸ã»ìµÄÎÊÌ⣬½ñÌì±»ÀÏʦµÄÌáʾºÍ×Ô¼ºµÄ˼¿¼ÖÕÓÚÕÒµ½Á˽â¾ö·½°¸£¬ÈÃ×Ô¼ºÓ¡ÏóÉî¿ÌÁË£¬Á½½Ú¿ÎҲûÓа×Ìý¡£
Õâ¾ÍÊǽñÌìµÄѧϰÇé¿öÁË£¬ÉÔ×ö±Ê¼Ç£¬ÒÔºóÒ²ÓÐЩ¾Ñé°É¡£
Ïà¹ØÎĵµ£º
1.´ò¿ªSQL server enterprise mananger “ÆóÒµ¹ÜÀíÆ÷”
ÔÚÄãÒªµ¼³öµÄSQLÊý¾Ý¿âÉÏÊó±êÓÒ¼ü²Ëµ¥£ºËùÓÐÈÎÎñ-¡·µ¼³öÊý¾Ý
2.»Ø³öÏÖÒ»¸öµ¼³öÏòµ¼´°¿Ú¡£
Ñ¡Ôñ±»µ¼³öµÄÊý¾ÝÔ´£¬ÎªÄã¸Õ²ÅËùÑ¡ÔñµÄÊý¾Ý¿â£¬Èç¹û·¢ÏÖ²»¶ÔÓ¦×ÔÐÐÐ޸ġ£
3.½øÈëµ¼³öµ½Ä¿±êÊý¾ÝÔ´µÄÑ¡Ôñ£¬ÕâÀïÎÒÃÇҪת³ÉACCESSµÄÊý¾Ý¿â¡£×¢ÒâÑ¡ÔñÊý¾ÝÔ´ÀàÐÍÎ ......
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
Use equality first.
ʹÓõÈÁ¬½Ó
Use range operators only where equality does not apply.
Ö»ÓÐÔÚµÈÁ¬½Ó²»¿ÉÓõÄÇé¿öÏÂÊÂÓÉÇø¼äÁ¬½Ó
Avoid use of negatives in the form of !=
or NOT.
±ÜÃâʹÓà £¡= »òÕß not
Avoid LIKE pattern matching.
±ÜÃâʹÓà LIKEÆ¥Åä
Try to retrieve specific rows and in small n ......
ÔÚSQLÓï¾äÖУ¬³£³£Óûá¶Ôʱ¼ä£¨»òÈÕÆÚ£©½øÐÐһЩ´¦Àí£¬ÏÂÃæÊDZȽÏͨÓõÄһЩÓï¾ä£º
ÑÓ³Ù£º
sysdate+(5/24/60/60) ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Ãë
sysdate+5/24/60 ÔÚϵͳʱ¼ä»ù´ ......
1.bzscs(ɳ³æ ÎÒ°®Ð¡ÃÀ)Óú¯數µÄºÃ辦·¨:
CREATE function [dbo].[calc_date](@time smalldatetime,@now smalldatetime)
returns nvarchar(10)
as
begin
declare @year int,@month int,@day int
select @year = datediff(yy,@time,@now)
if (month(@now)=month(@time)) and (day ......