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

¾«ÃîSQLÓï¾äÊÕ¼¯

                                                    ¾«ÃîSQLÓï¾äÊÕ¼¯ 
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿âCREATE DATABASE database-name 2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿âdrop database dbname3¡¢ËµÃ÷£º±¸·Ýsql server--- ´´½¨ ±¸·ÝÊý¾ÝµÄ deviceUSE masterEXEC sp_addumpdevice 'disk', 'testBack', 'c:mssql7backupMyNwind_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 only5¡¢ËµÃ÷£ºÉ¾³ýбí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 viewname10¡¢ËµÃ÷£º¼¸¸ö¼òµ¥µÄ»ù±¾µÄ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 as totalcount from table1ÇóºÍ£ºselect sum(field1) as sumvalue from table1ƽ¾ù£ºselect avg(field1) as avgvalue from table1×î´ó£ºselect max(field1) as maxvalue from table1×îС£ºselect min(field1) as minvalue from table111¡¢ËµÃ÷£º¼¸¸ö¸ß¼¶²éѯÔËËã´ÊA£º UNION ÔËËã·û UNION ÔËËã·ûͨ¹ý×éºÏÆäËûÁ½¸ö½á¹û±í£¨ÀýÈç TABLE1 ºÍ TABLE2£


Ïà¹ØÎĵµ£º

Oracle PL/SQL±à³Ì¹æ·¶Ö¸ÄÏ

Ò»¡¢PL/SQL±à³Ì¹æ·¶Ö®´óСд
¾ÍÏñÔÚSQLÖÐÒ»Ñù£¬PL / SQLÖÐÊDz»Çø·Ö´óСдµÄ¡£ÆäÒ»°ã×¼ÔòÈçÏ£º
¹Ø¼ü×Ö(BEGIN, EXCEPTION, END, IF THEN ELSE,LOOP, END LOOP)¡¢Êý¾ÝÀàÐÍ(VARCHAR2, NUMBER)¡¢ÄÚ²¿º¯Êý(LEAST, SUBSTR)ºÍÓû§¶¨ÒåµÄ×Ó³ÌÐò(procedures, functions,packages)£¬Ê¹Óôóд¡£
±äÁ¿ÃûÒÔ¼°SQLÖеÄÁÐÃûºÍ±íÃû£¬Ê¹ÓÃÐ ......

sql 2000 ¸´ÖƱí

SQLÓï¾äʵÏÖ£¬SQL Server 2000 ¼°ACCESS¸´ÖƾɱíOldTableµÄ½á¹¹£¬»ò½á¹¹¼°ÄÚÈݵ½ÐµıíNewTable
Á½¸ö¶¼ÊÔ¹ýÁË£¬ÏÂÃæµÄ´úÂëÔÚÕâÁ½¸öÊý¾Ý¿âÖУ¨SQL Server 2000 ¼°ACCESS£©¶¼ÊÇ¿ÉÒÔͨ¹ýµÄ¡£
--¸´ÖƱí½á¹¹ÎªÐµıí
select * into NewTable
from OldTable where 1=2
--¸´ÖƱí½á¹¹¼°ÄÚÈݵ½Ðµıí
select * into newtable ......

SQL ServerÖ´Ðв¿·ÖÓï¾äµÄÄÚ´æ´ú¼Û


ÖÚËùÖÜÖª£¬SQL ServerÖ´ÐÐSQLÓï¾äµÄÐÔÄÜÅж¨±ê×¼Ö÷ÒªÊÇIO¶ÁÈ¡Êý´óС¡£±¾ÎÄÔÚ²»Î¥·´ÕâÒ»Ô­ÔòÇé¿öÏ£¬Í¬Ê±À´·ÖÎöһϲ¿·ÖSQLÓï¾äÖ´ÐÐʱ£¬SQL ServerÄÚ´æµÄ±ä»¯Çé¿ö¡£
Ê×ÏȼòÊöÒ»ÏÂSQL ServerÄÚ´æÕ¼ÓõÄÌص㡣SQL ServerËùÕ¼ÓõÄÄÚ´æ³ý³ÌÐò£¨¼´SQL
ServerÒýÇ棩Í⣬Ö÷Òª°üÀ¨»º´æµÄÊý¾Ý£¨Buffer£©ºÍÖ´Ðмƻ®£¨Cache£©¡£SQL ......

Sql Server×Ö¶ÎÀàÐ͵Ä×Ö·û³¤¶È

sql serverÊý¾ÝÀàÐÍcharºÍnchar,varcharºÍnvarchar,textºÍntextÔÊÐíµÄ×Ö·û³¤¶È
×Ö·û´®
char
¹Ì¶¨³¤¶ÈµÄ·Ç Unicode ×Ö·ûÊý¾Ý£¬×î´ó³¤¶ÈΪ 8,000 ¸ö×Ö·û¡£
varchar
¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×Ϊ 8,000 ¸ö×Ö·û¡£
text
¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×î´ó³¤¶ÈΪ 2^31 - 1 (2,147,483,647) ¸ö×Ö·û¡£
Unicode ×Ö·û´® ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ