Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

³£Óþ­µäSQLÓï¾ä´óÈ«

 ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
¡¡¡¡SQL·ÖÀࣺ
¡¡¡¡DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
¡¡¡¡DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
¡¡¡¡DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
¡¡¡¡Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
¡¡¡¡1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
¡¡¡¡2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
¡¡¡¡3¡¢ËµÃ÷£º±¸·Ýsql server
¡¡¡¡--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice ’disk’, ’testBack’, ’c:\mssql7backup\MyNwind_1.dat’
¡¡¡¡--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
¡¡¡¡4¡¢ËµÃ÷£º´´½¨Ð±í
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
¡¡¡¡¸ù¾ÝÒÑÓÐµÄ±í´´½¨ÐÂ±í£º
A£ºcreate table tab_new like tab_old (ʹÓÃ¾É±í´´½¨Ð±í)
B£ºcreate table tab_new as select col1,col2… from tab_old definition only
¡¡¡¡5¡¢ËµÃ÷£º
¡¡¡¡É¾³ýÐÂ±í£ºdrop table tabname
¡¡¡¡6¡¢ËµÃ÷£º
¡¡¡¡Ôö¼ÓÒ»¸öÁУºAlter table tabname add column col type
¡¡¡¡×¢£ºÁÐÔö¼Óºó½«²»ÄÜɾ³ý¡£DB2ÖÐÁмÓÉϺóÊý¾ÝÀàÐÍÒ²²»Äܸı䣬ΨһÄܸıäµÄÊÇÔö¼ÓvarcharÀàÐ͵ij¤¶È¡£
¡¡¡¡7¡¢ËµÃ÷£º
¡¡¡¡Ìí¼ÓÖ÷¼ü£ºAlter table tabname add primary key(col)
¡¡¡¡ËµÃ÷£º
¡¡¡¡É¾³ýÖ÷¼ü£ºAlter table tabname drop primary key(col)
¡¡¡¡8¡¢ËµÃ÷£º
¡¡¡¡´´½¨Ë÷Òý£ºcreate [unique] index idxname on tabname(col….)
¡¡¡¡É¾³ýË÷Òý£ºdrop index idxname
¡¡¡¡×¢£ºË÷ÒýÊDz»¿É¸ü¸ÄµÄ£¬Ïë¸ü¸Ä±ØÐëɾ³ýÖØн¨¡£
¡¡¡¡9¡¢ËµÃ÷£º
¡¡¡¡´´½¨ÊÓͼ£ºcreate view viewname as select statement
¡¡¡¡É¾³ýÊÓͼ£ºdrop view viewname
10¡¢ËµÃ÷£º¼¸¸ö¼òµ¥µÄ»ù±¾µÄsqlÓï¾ä
¡¡¡¡Ñ¡Ôñ£ºselect * from table1 where ·¶Î§
¡¡¡¡²åÈ룺insert into table1(field1,field2) values(value1,value2)
¡¡¡¡É¾³ý£ºdelete from table1 where ·¶Î§
¡¡¡¡¸üУºupdate table1 set field1=value1 where ·¶Î§
¡¡¡¡²éÕÒ£ºselect * from table1 where field1 like ’%value1%’ ---likeµÄÓï·¨ºÜ¾«Ã²é×ÊÁÏ!
¡¡¡¡ÅÅÐò£ºselect * from table1 order by field1,field2 [desc]
¡¡¡¡×ÜÊý£ºselect count


Ïà¹ØÎĵµ£º

³£ÓõÄSQLÓï¾ä

н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [±í ......

SQL ServerµÄ¸´ºÏË÷Òýѧϰ

SQL ServerµÄ¸´ºÏË÷Òýѧϰ
¸ÅÒª
ʲôÊǵ¥Ò»Ë÷Òý,ʲôÓÖÊǸ´ºÏË÷ÒýÄØ? ºÎʱн¨¸´ºÏË÷Òý£¬¸´ºÏË÷ÒýÓÖÐèҪעÒâЩʲôÄØ£¿±¾ÆªÎÄÕÂÖ÷ÒªÊǶÔÍøÉÏһЩÌÖÂÛµÄ×ܽᡣ
Ò».¸ÅÄî
µ¥Ò»Ë÷ÒýÊÇÖ¸Ë÷ÒýÁÐΪһÁеÄÇé¿ö,¼´Ð½¨Ë÷ÒýµÄÓï¾äֻʵʩÔÚÒ»ÁÐÉÏ¡£
Óû§¿ÉÒÔÔÚ¶à¸öÁÐÉϽ¨Á¢Ë÷Òý£¬ÕâÖÖË÷Òý½Ð×ö¸´ºÏË÷Òý(×éºÏË÷Òý)¡£¸´ºÏË÷ÒýµÄ´´½¨· ......

SQL Server Á¬½Ó×Ö·û´®ºÍÉí·ÝÑéÖ¤

SQL Server .NET Data Provider Á¬½Ó×Ö·û´®°üº¬Ò»¸öÓÉһЩÊôÐÔÃû/Öµ¶Ô×é³ÉµÄ¼¯ºÏ¡£Ã¿Ò»¸öÊôÐÔ/Öµ¶Ô¶¼ÓɷֺŸô¿ª¡£
         PropertyName1=Value1;PropertyName2=Value2;PropertyName3=Value3;.....
ͬÑù£¬Á¬½Ó×Ö·û´®±ØÐë°üº¬SQL ServerʵÀýÃû³Æ:
     ......

SQL²éѯÖеÄתÒå×Ö·û ÀÁèÐÇ¿Õ

Èç¹ûÏë²éÕÒ“_cs”½áβµÄµÄÕË»§
select * from [user] where loginname like '%_cs'ÊDz»Ðеģ¬_ ±»ÈÏΪÊÇÈÎÒâµÄ×Ö·û£¬
ËùÒÔÐèҪתÒå×Ö·û£¬ÓÐÁ½ÖÖд·¨£º
select * from [user] where loginname like '%[_]cs'
select * from [user] where loginname like '%/_cs' escape'/'
ͨÅä·ûº¬Òå
%
°üº¬Áã¸ö»ò¸ü¶à×Ö· ......

¸ß¼¶SQL @Oracle

1.¼¯ºÏ²Ù×÷
ѧϰoracle
Öм¯ºÏ²Ù×÷µÄÓйØÓï¾ä£¬
ÕÆÎÕunion,union
all,minus,interestµÄʹÓÃ,Äܹ»ÃèÊö½áºÏÔËË㣬²¢ÇÒÄܹ»½«¶à¸ö²éѯ×éºÏµ½Ò»¸ö²éѯÖÐÈ¥£¬Äܹ»¿ØÖÆÐзµ»ØµÄ˳Ðò¡£
°üº¬¼¯ºÏÔËËãµÄ
²éѯ³ÆΪ¸´ºÏ²éѯ¡£¼û±í¸ñ1-1
±í1-1
Operator         Returns     &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ