sqlÓÅ»¯50Ìõ
ËäÈ»²éѯËÙ¶ÈÂýµÄÔÒòºÜ¶à£¬µ«ÊÇÈç¹ûͨ¹ýÒ»¶¨µÄÓÅ»¯£¬Ò²¿ÉÒÔʹ²éѯÎÊÌâµÃµ½Ò»¶¨³Ì¶ÈµÄ½â¾ö¡£ ²éѯËÙ¶ÈÂýµÄÔÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ£º
1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
2¡¢i/oÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
4¡¢ÄÚ´æ²»×ã
5¡¢ÍøÂçËÙ¶ÈÂý
6¡¢²éѯ³öµÄÊý¾ÝÁ¿¹ý´ó£¨¿ÉÒÔ²ÉÓöà´Î²éѯ£¬ÆäËûµÄ·½·¨½µµÍÊý¾ÝÁ¿£©
7¡¢Ëø»òÕßËÀËø(ÕâÒ²ÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
8¡¢sp_lock sp_who »î¶¯µÄÓû§²é¿´ ÔÒòÊǶÁд¾ºÕù×ÊÔ´¡£
9¡¢·µ»ØÁ˲»±ØÒªµÄÐкÍÁÐ
10¡¢²éѯÓï¾ä²»ºÃ£¬Ã»ÓÐÓÅ»¯
¿ÉÒÔͨ¹ýÈçÏ·½·¨À´ÓÅ»¯²éѯ :
1¡¢°ÑÊý¾Ý¡¢ÈÕÖ¾¡¢Ë÷Òý·Åµ½²»Í¬µÄi/oÉ豸ÉÏ£¬Ôö¼Ó¶ÁÈ¡Ëٶȣ¬ÒÔÇ°¿ÉÒÔ½«tempdbÓ¦·ÅÔÚraid0ÉÏ£¬sql2000²»ÔÚÖ§³Ö¡£Êý¾ÝÁ¿£¨³ß´ç£©Ô½´ó£¬Ìá¸ßi/oÔ½ÖØÒª.
2¡¢×ÝÏò¡¢ºáÏò·Ö¸î±í£¬¼õÉÙ±íµÄ³ß´ç(sp_spaceuse)
3¡¢Éý¼¶Ó²¼þ
4¡¢¸ù¾Ý²éѯÌõ¼þ ½¨Á¢Ë÷Òý¡¢ÓÅ»¯Ë÷Òý¡¢ÓÅ»¯·ÃÎÊ·½Ê½£¬ÏÞÖƽá¹û¼¯µÄÊý¾ÝÁ¿¡£×¢ÒâÌî³äÒò×ÓÒªÊʵ±£¨×îºÃÊÇʹÓÃĬÈÏÖµ0£©¡£Ë÷ÒýÓ¦¸Ã¾¡Á¿Ð¡£¬Ê¹ÓÃ×Ö½ÚÊýСµÄÁн¨Ë÷ÒýºÃ£¨²ÎÕÕË÷ÒýµÄ´´½¨£© ²»Òª¶ÔÓÐÏ޵ļ¸¸öÖµµÄ×ֶν¨µ¥Ò»Ë÷ÒýÈçÐÔ±ð×Ö¶Î
5¡¢Ìá¸ßÍøËÙ
6¡¢À©´ó·þÎñÆ÷µÄÄÚ´æ windows 2000ºÍsql server 2000ÄÜÖ§³Ö4-8gµÄÄÚ´æ¡£ÅäÖÃÐéÄâÄڴ棺ÐéÄâÄÚ´æ´óСӦ»ùÓÚ¼ÆËã»úÉϲ¢·¢ÔËÐеķþÎñ½øÐÐÅäÖá£ÔËÐÐ microsoft sql server 2000 ʱ£¬¿É¿¼Âǽ«ÐéÄâÄÚ´æ´óСÉèÖÃΪ¼ÆËã»úÖа²×°µÄÎïÀíÄÚ´æµÄ 1.5 ±¶¡£Èç¹ûÁíÍâ°²×°ÁËÈ«ÎļìË÷¹¦ÄÜ£¬²¢´òËãÔËÐÐ microsoft ËÑË÷·þÎñÒÔ±ãÖ´ÐÐÈ«ÎÄË÷ÒýºÍ²éѯ£¬¿É¿¼ÂÇ£º½«ÐéÄâÄÚ´æ´óСÅäÖÃΪÖÁÉÙÊǼÆËã»úÖа²×°µÄÎïÀíÄÚ´æµÄ 3 ±¶¡£½« sql server max server memory ·þÎñÆ÷ÅäÖÃÑ¡ÏîÅäÖÃΪÎïÀíÄÚ´æµÄ 1.5 ±¶£¨ÐéÄâÄÚ´æ´óСÉèÖõÄÒ»°ë£©¡£
7¡¢Ôö¼Ó·þÎñÆ÷cpu¸öÊý µ«ÊDZØÐëÃ÷°×²¢Ðд¦Àí±È´®Ðд¦Àí¸üÐèÒª×ÊÔ´ÀýÈçÄڴ档ʹÓò¢Ðл¹ÊÇ´®ÐгÌÊÇmssql×Ô¶¯ÆÀ¹ÀÑ¡ÔñµÄ¡£µ
Ïà¹ØÎĵµ£º
insert into A ±í select * from B ±í;
ÔÚoracleÖУ¬Ã¿¸öÓû§Ö»ÄܲÙ×÷×Ô¼ºµÄ±í£¬Òª²Ù×÷ÆäËûÓû§µÄ±íÊÇÐèÒªÆäËûÓû§¸³È¨Ï޵ġ£
grant ȨÏÞ on table to user;
eg:grant select on table to newuser;
ÈôÒª½øÐÐÁ¬½Ó¾ÍÒªÊÚÓè(resource connect Á½¸ö½ÇÉ«) ......
н¨Ñ§Éú-¿Î³ÌÊý¾Ý¿âµÄÈý¸ö±í:
ѧÉú±í:Student(Sno,Sname,Ssex,Sage,Sdept) SnoΪÖ÷Âë;
¿Î³Ì±í:Course(Cno,Cname,Cpno,Credeit) CnoΪÖ÷Âë;
ѧÉúÑ¡ÐÞ±í:SC(Sno,Cno,Grade) Sno,Cno,ΪÖ÷Âë;
Student
ѧºÅ
SnoÐÕÃû
SnameÐÔ±ð
SsexÄêÁä
SageËùÔÚϵ
Sdept
95001ÀîÓÂÄÐ20CS
95002Áõ³¿Å®19IS
95003ÍõÃôÅ®18MA
95004 ......
ÉÏ»ØÎÒÃÇ˵µ½ÆÀ¹ÀÒ»ÌõÓï¾äÖ´ÐÐЧÂÊÖ÷Òª¿´Âß¼ IO £¨É¶ÊÇÂß¼ IO £¬É¶ÊÇÎïÀí IO ¼ûÁª»úÎĵµ£©£¬Õâ´ÎÎÒÃǼÌÐø¡£
ÎÒÃÇÏÈ˵˵£¬·µ»Ø¶àÐнá¹ûʱ£¬ÎªÊ²Ã´ SQLServer ÓÐʱ»áÑ¡Ôñ index seek £¬ÓÐʱ»áÑ¡Ôñ index scan ¡£
ÒÔ nonclustered index ΪÀý˵Ã÷¡£
ÏñËùÓеÄË÷Òý B Ê÷Ò»Ñù£¬·Ç¾Û¼¯Ë÷ÒýÊ÷Ò²°üÀ¨ÍêÈ«ÓÉË÷ÒýÊý¾Ý×é³ÉµÄ¸ù½ ......
¹ØÓÚ±¾Îı¾ÎÄËùÃè»æµÄ¹¦Äܺͼƻ®ÊÇÏÂÒ»°æ±¾ SQL Server µÄ¿ª·¢·½Ïò¡£ËüÃDz¢·Ç±¾²úÆ·µÄ˵Ã÷Ê飬ÈçÓиü¸Ä£¬Ë¡²»ÁíÐÐ֪ͨ¡£¶ÔÓÚ×îÖÕ²úÆ·ÊÇ·ñ¾ßÓÐÕâЩ¹¦Äܲ»×öÈκÎÃ÷ʾ»ò°µÊ¾µÄ±£Ö¤¡£¶ÔÓÚijЩ¹¦ÄÜ£¬±¾ÎļÙÉè¶ÁÕßÊìϤ SQL Server 2000 ¹¦ÄܺͷþÎñ¡£Óйر³¾°ÐÅÏ¢£¬Çë·ÃÎÊSQL Server ÍøÕ¾»ò SQL Server 2000 ×ÊÔ´¹¤¾ß°ü¡£Õâ²¢²»Ê ......
»ù±¾µÄSql±àдעÒâÊÂÏî
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊ ......