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

SQL Server Êý¾Ý¿â

a.Êý¾Ý¿â»ù´¡
      i.¸ÅÄ±í¼°Ïà¹Ø²Ù×÷¶ÔÏóµÄ¼¯ºÏ£¨Ö÷Êý¾ÝÎļþmdf£¬¶þ¼¶Êý¾ÝÎļþndf£¬ÈÕÖ¾ldf£©
      ii.×é³É£ºÏµÍ³£º master(¼Ç¼ÁËËùÓеķþÎñÆ÷ϵͳÐÅÏ¢)
,model£¨¼Ç¼ÁËËùÓÐÁÙʱ¼Ç¼£¬Á´½Ó¶Ï¿ªÊ±£¬Êý¾Ý¶ªÊ§£©
Tempdb£¨Êý¾ÝÄ£°å¿â£¬º¬´´½¨¿âʱµÄȱʡÊý¾Ý£©
,msdb £¨µ÷¶È¿â£¬´úÀí³ÌÐòµ÷¶È¾¯±¨ºÍ×÷Òµ£©
               Óû§£ºpubs,northwind,user
b.½¨¿â
 crate database data1
on
(
 Name=da_dat,filename=’f:\data1.mdf’,
 Size=10,
Maxsize=50,
Filegrowth=5
)
Log on
(
Name=’da_log’,filename=’f:\data1.ldf’,
Size=5,
Maxsize=25,
Filegrowth=5
)
   C.Ð޸Ŀâ
      i.Ìí¼Ó alter database data1
             add file
             (
              Name=file2,filename=’f:\grpfile2.ndf’,size=5,maxsize=25,filegrowth=1
)
      ii.ɾ³ý£» drop database
      iii;ÖØÃüÃû£»sp_rename
      iiii;²é¿´Êý¾Ý¿â£»sp_helpdb
 D.Êý¾ÝÍêÕûÐÔ (±£Ö¤Êý¾ÝµÄÒ»ÖÂÐÔºÍÕýÈ·ÐÔ)
   a. ʵÌåÐÔ£¨±£Ö¤Äܱ»Ö÷¼üÊôÐÔ±êʶ£©
   b. ÓòÍêÕûÐÔ £¨±£Ö¤Ä³Ò»·¶Î§ÄÚµÄÖµ²ÅÄܱ»´æ´¢£©
   c. ÒýÓÃÍêÕûÐÔ £¨±£Ö¤Ö÷£¬Íâ¼üÆ¥Å䣩
   d. Óû§×Ô¶¨Òå £¨Óû§Ö¸¶¨µÄÒ»×é¹æÔò £©
E£®Ô¼Êø
   a. null£»²»ÊÇ09»ò¿Õ°×£¬±íʾûÊäÈëÈκÎÖµ
   b. Ö÷¼ü£»Ò»¸ö±íÖ»ÄÜÓÐÒ»¸ö£¨primary key£©
   c. Ψһ£»unique£¨Ò»¸ö±í¿ÉÒÔÓжà¸öΨһԼÊø£¬ÔÊÐí¿ÕÖµ£©
   d. Íâ¼ü£» foreign key
   e. ¼ì²é£»
   f. ȱʡ£»Ä¬ÈÏÖµ£¨default£©
F.Êý¾ÝÓÐЧÐÔ
  a.¼¶ÁªÐÞ¸ÄÓÚɾ³ý
Àý£º
   Use xx
Create table tbuser
(
 userID int identity(1000,1) not null primary key,
 username varchar


Ïà¹ØÎĵµ£º

sqlÓï¾ä

1. ²é¿´Êý¾Ý¿âµÄ°æ±¾       
   select @@version
  2. ²é¿´Êý¾Ý¿âËùÔÚ»úÆ÷²Ù×÷ϵͳ²ÎÊý       
  exec master..xp_msver
  3. ²é¿´Êý¾Ý¿âÆô¶¯µÄ²ÎÊý        
  ......

SQL²Ù×÷

QL·ÖÀࣺ
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¡¿Ê¹ÓÃÒ»ÌõINSERTÓï¾äÍê³É¶à±í²åÈë

ÕâÊÇÒ»Ìõµß¸²³£¹æµÄ²åÈë·½·¨£¬Ò»ÌõINSERTÓï¾ä¿ÉÒÔÍê³ÉÏò¶àÕűíµÄ²åÈëÈÎÎñ¡£Ð¡Ð¡µØչʾһÏÂÕâÖÖ²åÈë·½·¨¡£
1.´´½¨±íT²¢³õʼ»¯²âÊÔÊý¾Ý£¬´Ë±í×÷ΪÊý¾ÝÔ´¡£
sec@ora10g> create table t (x number(10), y varchar2(10));
sec@ora10g> insert into t values (1,'a');
sec@ora10g> insert into t values (2,'b');
......

£¨×ª£©SQL²éѯÂýµÄ48¸öÔ­Òò·ÖÎö

ת×Ô£ºhttp://topic.csdn.net/u/20100109/09/70f82fb7-eabc-4140-9573-5f8395e0f62e.html
²éѯËÙ¶ÈÂýµÄÔ­ÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ£º
¡¡¡¡1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
¡¡¡¡4¡¢ÄÚ´æ²»×ã
¡¡¡ ......

ÈçºÎÖ´ÐÐÒ»¸ömysqlµÄsql½Å±¾Îļþ


2009-12-08 18:53
sql½Å±¾ÊÇ°üº¬Ò»µ½¶à¸ösqlÃüÁîµÄsqlÓï¾ä£¬ÎÒÃÇ¿ÉÒÔ½«ÕâЩsql½Å±¾·ÅÔÚÒ»¸öÎı¾ÎļþÖУ¨ÎÒÃdzÆ֮Ϊ“sql½Å±¾Îļþ”£©£¬È»ºóͨ¹ýÏà¹ØµÄÃüÁîÖ´ÐÐÕâ¸ösql½Å±¾Îļþ¡£»ù±¾²½ÖèÈçÏ£º
1¡¢´´½¨°üº¬sqlÃüÁîµÄsql½Å±¾Îļþ
ÎļþÖаüº¬Ò»Ð©ÁеÄsqlÓï¾ä£¬Ã¿ÌõÓï¾ä×îºóÒÔ;½á⣬ÎļþÄÚÈÝʾÀýÈçÏ£º
--´´½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ