SQLÓï¾äÓÅ»¯·½·¨
1.Ö»²éѯÐèÒªµÄÁУ¬²»ÓÃ*
2.INÊʺÏÓÚÍâ±í´ó¶øÄÚ±íСµÄÇé¿ö£»EXISTSÊʺÏÓÚÍâ±íС¶øÄÚ±í´óµÄÇé¿ö 1¡¢Éý¼¶Ó²¼þ
2¡¢¸ù¾Ý²éѯÌõ¼þ,½¨Á¢Ë÷Òý,ÓÅ»¯Ë÷Òý¡¢ÓÅ»¯·ÃÎÊ·½Ê½£¬ÏÞÖƽá¹û¼¯µÄÊý¾ÝÁ¿¡£
3¡¢À©´ó·þÎñÆ÷µÄÄÚ´æ
4¡¢Ôö¼Ó·þÎñÆ÷CPU¸öÊý
5¡¢¶ÔÓÚ´óµÄÊý¾Ý¿â²»ÒªÉèÖÃÊý¾Ý¿â×Ô¶¯Ôö³¤£¬Ëü»á½µµÍ·þÎñÆ÷µÄÐÔÄÜ
6¡¢ÔÚ²éѯSelectÓï¾äÖÐÓÃWhere×Ö¾äÏÞÖÆ·µ»ØµÄÐÐÊý,±ÜÃâ±íɨÃè,Èç¹û·µ»Ø²»±ØÒªµÄÊý¾Ý£¬ÀË·ÑÁË·þÎñÆ÷µÄI/O×ÊÔ´£¬¼ÓÖØÁËÍøÂçµÄ¸ºµ£½µµÍÐÔÄÜ¡£Èç¹û±íºÜ´ó£¬ÔÚ±íɨÃèµÄÆڼ佫±íËøס£¬½ûÖ¹ÆäËûµÄÁª½Ó·ÃÎʱí,ºó¹ûÑÏÖØ¡£
7¡¢²éѯʱ²»Òª·µ»Ø²»ÐèÒªµÄÐС¢ÁÐ
8¡¢ÓÃselect top 100 / 10 Percent À´ÏÞÖÆÓû§·µ»ØµÄÐÐÊý»òÕßSET ROWCOUNTÀ´ÏÞÖƲÙ×÷µÄÐÐ
9¡¢ÔÚINºóÃæÖµµÄÁбíÖУ¬½«³öÏÖ×îƵ·±µÄÖµ·ÅÔÚ×îÇ°Ã棬³öÏÖµÃ×îÉٵķÅÔÚ×îºóÃ棬¼õÉÙÅжϵĴÎÊý
10¡¢Ò»°ãÔÚGROUP BY ¸öHAVING×Ö¾ä֮ǰ¾ÍÄÜÌÞ³ý¶àÓàµÄÐУ¬ËùÒÔ¾¡Á¿²»ÒªÓÃËüÃÇÀ´×öÌÞ³ýÐеŤ×÷¡£ËûÃǵÄÖ´ÐÐ˳ÐòÓ¦¸ÃÈçÏÂ×îÓÅ£º
selectµÄWhere×Ö¾äÑ¡ÔñËùÓкÏÊʵÄÐУ¬Group ByÓÃÀ´·Ö×é¸öͳ¼ÆÐУ¬Having×Ö¾äÓÃÀ´ÌÞ³ý¶àÓàµÄ·Ö×é¡£ÕâÑùGroup By ¸öHavingµÄ¿ªÏúС£¬²éѯ¿ì.¶ÔÓÚ´óµÄÊý¾ÝÐнøÐзÖ×éºÍHavingÊ®·ÖÏûºÄ×ÊÔ´¡£Èç¹ûGroup BYµÄÄ¿µÄ²»°üÀ¨¼ÆË㣬ֻÊÇ·Ö×飬ÄÇôÓÃDistinct¸ü¿ì
11¡¢Ò»´Î¸üжàÌõ¼Ç¼±È·Ö¶à´Î¸üÐÂÿ´ÎÒ»Ìõ¿ì,¾ÍÊÇ˵Åú´¦ÀíºÃ MS SQL Server²éѯÓÅ»¯·½·¨
²éѯËÙ¶ÈÂýµÄÔÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ 1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
4¡¢ÄÚ´æ²»×ã
5¡¢ÍøÂçËÙ¶ÈÂý
6¡¢²éѯ³öµÄÊý¾ÝÁ¿¹ý´ó£¨¿ÉÒÔ²ÉÓöà´Î²éѯ£¬ÆäËûµÄ·½·¨½µµÍÊý¾ÝÁ¿£©
7¡¢Ëø»òÕßËÀË
Ïà¹ØÎĵµ£º
Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º
--Excel---->SQL2005 µ¼È룺
select * into useinfo from O ......
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
linq×î½üÔ½À´Ô½»ð ´ÓÍøÉÏ¿´ÁËÏà¹Ø½Ì³Ì
ÊÔ×ÅдÁËһЩ¶«Î÷£¡
ÏÂÃæÊÇÒ»¸ö¼òµ¥µÄÔöɾ¸Ä²é¹¦ÄÜ£¡£¡£¡
Àà:
ÏÂÃæÊǶÔÕâ¸ö±í½øÐвÙ×÷ÁË
Ìù´úÂë:
public class LinqTosql
{
public static GameCardSaleDataContext data = new GameCardSaleDataContext();
//Êä³öÐÂÎűíËùÓбêÌâ
public ......
using (DataClasses1DataContext a = new DataClasses1DataContext())
{
}
ÕâÑùд±È½Ï·½±ã
¸üÐÂʱ,Èç¹û±íûÓÐÖ÷¼ü,ÄDz»»á¸üÐÂ,Ò²²»»á±¨´í,ÉèÁËÖ÷¼üºó,ÖØ¿ªÁ¬½Ó,ÖØÐÂÍÏÒ»¸öµ½ContextÀïÃæ
Èç¹û±íµÄÓ³ÉäÀ಻ÊÇ´ÓcontextÀïÃæËѳöÀ´µÄ,¶øÊÇ×Ô¼ºnewµÄ
ÓÃcontext.±íÀà.Attach(ÍâÃæµÄÀà,true/false)¸üР......
Èç¹ûÄãÕýÔÚ¸ºÔðÒ»¸ö»ùÓÚSQL ServerµÄÏîÄ¿£¬»òÕßÄã¸Õ¸Õ½Ó´¥SQL Server£¬Ä㶼ÓпÉÄÜÒªÃæÁÙһЩÊý¾Ý¿âÐÔÄܵÄÎÊÌ⣬ÕâƪÎÄÕ»áΪÄãÌṩһЩÓÐÓõÄÖ¸µ¼£¨ÆäÖдó¶àÊýÒ²¿ÉÒÔÓÃÓÚÆäËüµÄDBMS£©¡£
ÔÚÕâÀÎÒ²»´òËã½éÉÜʹÓÃSQL ServerµÄÇÏÃÅ£¬Ò²²»ÄÜÌṩһ¸ö°üÖΰٲ¡µÄ·½°¸£¬ÎÒËù×öµÄÊÇ×ܽáһЩ¾Ñé----¹ØÓÚÈçºÎÐγÉÒ»¸öºÃµÄÉè¼Æ ......