SQLÓïÑÔ»ù´¡ Êý¾Ý¶¨Òå
1¡¢¶¨Òå»ù±¾±í
SQLÓïÑÔʹÓö¯´ÊCREATE¶¨Òå»ù±¾±í£¬Æä¾ßÌåÓï·¨¸ñʽÈçÏ£º
CREATE TABLE <±íÃû>
(<ÁÐÃû><Êý¾ÝÀàÐÍ>[Áм¶ÍêÕûÐÔÔ¼ÊøÌõ¼þ]...[£¬<ÁÐÃû><Êý¾ÝÀàÐÍ>[Áм¶ÍêÕûÐÔÔ¼ÊøÌõ¼þ]][,<±í¼¶ÍêÕûÐÔÔ¼ÊøÌõ¼þ>])£»
ÀýÈ磺½¨Á¢Ò»¸öѧÉú±íStudent£¬ËüÓÉѧºÅSno£¬ÐÕÃûSname£¬ÐÔ±ðSsex£¬ÄêÁäSage£¬ËùÔÚϵSdeptÕâ5¸öÊôÐÔ×é³É¡£ÆäÖÐѧºÅ²»ÄÜΪ¿Õ£¬ÖµÊÇΨһµÄ£¬²¢ÇÒÐÕÃûȡֵҲΨһ¡£SQLÃüÁîÈçÏ£º
CREATE TABLE Student
(Sno CHAR(5) NOT NULL UNIQUE,
Sname CHAR(20) UNIQUE,
Ssex CHAR(2),
Sage INT,
Sdept CHAR(15));
¶¨Òå±íµÄ¸÷¸öÊôÐÔʱÐèÒªÖ¸Ã÷ÆäÊý¾ÝÀàÐͼ°³¤¶È¡£
SMALLINT °ë×Ö³¤¶þ½øÖÆÕûÊý¡£
INTEGER»òINT È«×Ö³¤¶þ½øÖÆÕûÊý¡£
DECIMAL(p[,q])»òDEC(p[,q]) ѹËõÊ®½øÖÆÊý£¬¹²P룬ÆäÖÐСÊýλÓÐqλ¡£0<=q<=p<=15,q=0ʱ¿ÉÒÔÊ¡ÂÔ²»Ð´¡£
FLOAT Ë«×Ö³¤¸¡µãÊý¡£
CHARTER(n)»òCHAR(n) ³¤¶ÈΪnµÄ¶¨³¤×Ö·û´®¡£
VARCHAR(n) ×î´ó³¤¶ÈΪnµÄ±ä³¤×Ö·û´®¡£
GRAPHIC(n) ³¤¶ÈΪnµÄ¶¨³¤Í¼ÐÎ×Ö·û´®¡£
VARGRAPHIC(n) ×î´ó³¤¶ÈΪnµÄ±ä³¤Í¼ÐÎ×Ö·û´®¡£
DATE ÈÕÆÚÐÍ£¬¸ñʽΪYYYY-MM-DD¡£
TIME ʱ¼äÐÍ£¬¸ñʽΪHH.MM.SS¡£
TIMESTAMP ÈÕÆÚ¼Óʱ¼ä¡£
2¡¢Ð޸Ļù±¾±í
°üÀ¨Ôö¼ÓÐÂÁС¢É¾³ýÔ¼Êø¡¢ÐÞ¸ÄÊý¾ÝÀàÐÍ¡£Ð޸Ļù±¾±íµÄÃüÁî¸ñʽÈçÏ£º
ALTER TABLE <±íÃû>
[ADD<ÐÂÁÐÃû><Êý¾ÝÀàÐÍ>[ÍêÕûÐÔÔ¼Êø]] //Ôö¼ÓÐÂÁÐ
[DROP<ÍêÕûÐÔÔ¼ÊøÃû>] //ɾ³ýÔ¼Êø
[MODIFY<ÁÐÃû><Êý¾ÝÀàÐÍ>]£» //ÐÞ¸ÄÊý¾ÝÀàÐÍ
ÀýÈ磺ÏòStudent±íÔö¼Ó“Èëѧʱ¼ä”ÁÐScome£¬ÆäÊý¾ÝÀàÐÍΪÈÕÆÚÐÍ¡£SQLÃüÁîÈçÏ£º
ALTER TABLE ADD Scome Scome Date£»
3¡¢É¾³ý»ù±¾±í
DROP TABLE <±íÃû>
ÀýÈ磺Ҫɾ³ýÃûΪStudentµÄ±í£¬SQLÃüÁîÈçÏ£º
DROP TABLE Student£»
×¢Ò⣺»ù±¾±íÒ»µ©±»É¾³
Ïà¹ØÎĵµ£º
³£ÓÃSQL²éѯ£º
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС
select t ......
http://msdn.microsoft.com/zh-cn/library/bb546187.aspx
http://www.cnblogs.com/kirinboy/archive/2010/01/20/linq-to-sql-update-1.html
¡¾ÒýÎÄ¡¿
ÔÚѧϰLINQʱ£¬ÎÒ¼¸ºõ±»Ò»¸öÀ§ÄÑËù»÷µ¹£¬Õâ¾ÍÊÇÄã´Ó±êÌâÖп´µ½µÄ¸üÐÂÊý¾Ý¿âµÄ²Ù×÷¡£ÏÂÃæÎÒ¾ÍÒ»²½²½´øÄã×ßÈëÕâÄà̶£¬Çë×¼±¸ºÃשͷºÍ¿ÚË®£¬Follow me¡£
´Ó×î¼òµ¥µÄÇé¿öÈë ......
±¾ÖܺÍÉÏÖܾÀí¸øÎÒÃÇ×öÁËÁ½´Î¹ØÓÚsqlµÄÅàѵ£¬¸Ð¾õºÜÓÐÓÃËùÒÔ×ܽáһϣ¡
Union£ºÖ»ÓÐÁ½Õűí½á¹¹ÏàͬµÄ½á¹û¼¯²ÅÄÜʹÓÃunion£¬½«ËùÓеıíÊý¾Ý·Åµ½Ò»¸ö½á¹û¼¯ÖС£
Count£º¼ÆËã²ÎÊýÁбíÖеÄÊý×ÖÏîµÄ¸öÊý¡£À¨ºÅÀï±ß¿ÉÒÔÊÇÁÐÃû£¬Ò²¿ÉÒÔÊDzÎÊýÖµ¡£
  ......
SQL Server 2005ÆôÓÃsaÕ˺Å
ÆôÓÃsaÓû§ºÍÔ¶³ÌÁ¬½Ó
²Ëµ¥Start->Microsoft SQL Server 2005->Configuration Tools->SQL Server Configuration Manager
Ñ¡ÖÐSQL Server 2005 Network Configuration
ÔÚÓұߵÄTCP/IPÉϵãÓÒ¼ü£¬enabled
²Ëµ¥Start->Microsoft SQL Server 2005->SQL ......
ÔÚÕâÀï,ÎÒËùÖ¸µÄ°æ±¾ÊÇÖ¸µÄ2000,2005,2008ÕâÑùµÄ°æ±¾Çø±ð,¶ø²»ÊÇÆóÒµ°æ,¿ª·¢°æÕâÑùµÄ°æ±¾Çø±ð.´Ó¹Ù·½µÄ˵·¨À´¿´,SQL ServerÊÇÔÊÐíÊý¾Ý¿â´ÓµÍ°æ±¾Ïò¸ß°æ±¾»Ö¸´,µ«²»Ö§³Ö¸ß°æ±¾ÏòµÍ°æ±¾µÄ»Ö¸´,Èç¹ûÎÒÃÇÓø߰汾µÄÊý¾Ý¿âÔڵͰ汾µÄÊý¾Ý¿âÒýÇæÏ»ָ´,»á³öÏÖʲô´íÎóÃèÊöÄØ?
......