SQL »ù±¾²Ù×÷ ɾ³ý ÐÞ¸Ä Ë¢ÐÂ
SQLµÄ²Ù×÷£º
E.g.
judging-±íÃû
userid, name, password-±íÖеĹؼü×Ö
Ìí¼Ó£º
string sql = "insert into judging (userid,name,password) values('" + userid.Text.Trim() + "','" + name.Text.Trim() + "','" + password.Text.Trim() + "')";
ɾ³ý£º
string sql = "delete from judging where userid=" + app.value;
Ð޸ģº
string sql = "update judging set name='"+modifyname+"',password='"+modifypsw+"'where userid=" + app.value ;
²éѯ£º
sql = "select * from judging where name='" + comboBoxName.Text + "' and userid='" + comboBoxID.Text + "'";
¸üУº
string sql = "select userid as userid,name as name from judging";
Ïà¹ØÎĵµ£º
¼Ü¹¹£¨Schema£©¡£Î¢ÈíµÄ¹Ù·½ËµÃ÷£¨MSDN£©£º
"Êý¾Ý¿â¼Ü¹¹ÊÇÒ»¸ö¶ÀÁ¢ÓÚÊý¾Ý¿âÓû§µÄ·ÇÖظ´ÃüÃû¿Õ¼ä£¬Äú¿ÉÒÔ½«¼Ü¹¹ÊÓΪ¶ÔÏóµÄÈÝÆ÷"£¬Ïêϸ²Î¿¼
http://technet.microsoft.com/zh-cn/library/ms190387.aspx.ÎÒÃÇÖªµÀ£¬ÔÚJAVAÖУ¬ÃüÃû¿Õ
¼äÃûÆäʵ¾ÍÊÇÎļþ¼ÐÃû¡£Òò´ËÎÒÃǷdz£Ã÷È·Ò»µã£ºÒ»¸ö¶ÔÏóÖ»ÄÜÊôÓÚÒ»¸ö¼Ü¹¹£¬¾ÍÏ ......
ÏÂÃæÊDzÙ×÷²½Ö裺
1. “·þÎñºÍÁ¬½ÓµÄÍâΧӦÓÃÅäÖÓ -¡·“±¾µØÁ¬½ÓºÍÔ¶³ÌÁ¬½Ó”-¡·“ͬʱʹÓÃTCP/IPºÍNamed Pipes“£»
2. “·þÎñÅäÖùÜÀíÆ÷”-¡·“ÍøÂçÅäÖÔ-¡·“SQL ExpressµÄÐÒé“-¡·“IPµØÖ·”£¬½«IpAll Tcp¶Ë¿Ú¸ÄΪ1433£»
3. ÖØÆô·þ ......
¿´¿´ÒÔÏÂSQLÓï¾ä£º
select row_number() over(partition by xs.xsbh, xs.kch order by coalesce(xs.bkxnxqh, xs.xnxqh) desc) rn
row_number()£º´ú±íÁÐ
partition by ´ú±í°´Ê²Ã´½øÐзÖ×é
order by¶Ôÿһ×éÐÅÏ¢½øÐÐÅÅÐò
coalesce()ÊÇÌæ»»µÄÒâ˼ ÀýÈ磺ÉÏÃæµÄSQLÓï¾äµÄÒâ˼ÊÇ£¬Èç¹ûbkxnxqhΪ¿Õ£¬ÄÇô¾ÍÈ¥xnx ......
Æô¶¯ÓëÅäÖòÎÊý ¸ü¸ÄϵͳԪÊý¾ÝºÍ²ÎÊýÅäÖà ¶¯Ì¬ÊÓͼ ´æ´¢µÄÎïÀíºÍÂß¼½á¹¹ Æô¶¯ºÍ¹Ø±Õ
topÆô¶¯ÓëÅäÖòÎÊý
ÔÚSQL Server°²×°µÄʱºò£¬Í¬Ê±Ò²»áÍùWindows×¢²á±íÀïÃæÌí¼ÓһЩ¼Ç¼£¬ÕâЩע²á±í¼üÖµÖ¸¶¨ÁËʵÀýËùÐèÒªµÄ¸÷ÖÖ²ÎÊý¡£±ÈÈ磬ÓеÄ×¢²á±í¼üÖµÖ¸¶¨ÁË´íÎóÈÕÖ¾µÄ±£´æĿ¼£¬ÁíÍâµÄÖ¸¶¨ÁËĬÈϵı¸·ÝĿ¼µÈµÈ¡£SQL ServerÔÚÔ ......
xtype ´ú±íÀàÐÍ
C = CHECK Ô¼Êø
D = ĬÈÏÖµ»ò DEFAULT Ô¼Êø
F = FOREIGN KEY Ô¼Êø
L = ÈÕÖ¾
FN = ±êÁ¿º¯Êý
IF = ÄÚǶ±íº¯Êý
P = ´æ´¢¹ý³Ì
PK = PRIMARY KEY Ô¼Êø£¨ÀàÐÍÊÇ K£©
RF = ¸´ÖÆɸѡ´æ´¢¹ý³Ì
S = ϵͳ±í
TF = ±íº¯Êý
TR = ´¥·¢Æ÷
U = Óû§±í
UQ = UNIQUE Ô¼Êø£¨ÀàÐÍÊÇ K£©
V = ÊÓͼ ......