Êý¾Ý¿âÆÚÄ©¸´Ï° SQLÓïÑÔ
Ò»¡¢SQLÓïÑÔÖ÷Òª×é³É²¿·Ö ¶þ¡¢DDL ˵Ã÷£ººóÐøµÄËùÓвÙ×÷Õë¶Ôcreate table Öн¨µÄÈýÕÅ±í ¢Ùcreate table
student±í£º 1 Create Table Student 2 ( 3 sno char(10) primary key(sno) , 4 sname varchar(20) not null, 5 sage smallint, 6 ssex char(2), 7 sdept char(10) 8 ) course±í£º 1 Create Table Course 2 ( 3 cno char(10) primary key (cno) , 4 cname varchar(20) , 5 credit smallint 6 ) sc±í£º 1 Create Table SC 2 ( 3 sno char(10) not null , 4 cno char(10) not null , 5 grade smallint, 6 primary key (sno, cno) 7 ) ¢Údrop table 1 drop table student cascade cascade:±íÊ¾Ç¿ÖÆÉ¾³ý
restrict
Ïà¹ØÎĵµ£º
ACCESS SQLÓï·¨²Î¿¼
=================
Ò». »ù´¡¸ÅÄî
¿ÉÒÔʹÓõÄÊý¾ÝÀàÐÍÈçÏ£º
1. TEXT£ºÎı¾ÐÍ£¨Ö¸¶¨³¤¶Èʱ£©£¬±¸×¢ÐÍ£¨²»Ö¸¶¨³¤¶Èʱ£©£»
2.
CHAR£¬NCHAR£¬VARCHAR£¬NVARCHAR£ºÎı¾ÐÍ£¬¿ÉÒÔÖ¸¶¨³¤¶È£¬·ñÔòĬÈÏֵΪ255£¡
3. ......
SQL²Ù×÷È«¼¯
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE ......
×î½ü·ÖÇøMS SQL SERVERµÄ±í·ÖÇø£¬¸Ð¾õÉõÊǸ´ÔÓ¡£ 1. Ŀǰֻ֪µÀMS SQL SERVERÖ§³Ö·¶Î§·ÖÇøhttp://msdn.microsoft.com/zh-cn/library/ms187802.aspx£¬ ÔÚ¹Ù·½ÍøÕ¾µÄ˵Ã÷ÎĵµÀïÃæ£¬Ò²Ã»ÓÐ˵֧³ÖÆäËûµÄ·ÖÇø¡£ÍøÉÏÓÐÐÖµÜ˵»¹Ö§³Öhash·ÖÇø¡£²»ÖªµÀÊÇÔõôʵÏֵġ£ÒòΪʹÓ÷ÖÇøº¯Êý£¬ÎÒÖ»ÖªµÀÄÜŪ³ö·¶Î§·ÖÇø¡£Í¬OracleµÄ±í·ÖÇøÏà± ......
Q£º±ßÉϵÄͬÊÂ˵Îļþ×é°üº¬¶à¸öÎļþ¿ÉÒÔÔö¼Ó²¢Ðжȣ¬Ò²¾ÍÊǶà¸öCPU¿ÉÒÔÒ»Æð¶Á£¿
A£º¿ÉÒÔÔö¼Ó²¢Ðжȣ¬µ«Ç°ÌáÊÇÊý¾Ý¿â¿ÉÒÔÖ§³Ö¶àÏ̷߳ÃÎʲ»Í¬µÄ·ÖÇø£¬¾Ý˵2005µÄ·ÖÇø±í²¢²»ÊÇÿ¸ö·ÖÇø¶¼·ÖÅäÒ»¸öỊ̈߳¬µ«ÊÇ2008Ã²ËÆ¾ÍÊÇ¡£Æä´Î£¬Èç¹ûÊǶàCPU£¬¶à´ÅÅÌ£¬»áÔö¼Ó²¢Ðжȵġ£¶à¸öCPUÒ»Æð¶ÁÒ²Òª¿´ÕâЩ¶à¸öÎļþÊDz»ÊÇ·ÅÔÚÒ»¸ö ......
³£Óú¯Êý
select replicate('a1',3)--a1µÄÖµÖØ¸´Èý´Î
½á¹ûΪ£ºa1a1a1
select len('222')
--¼ÆËã×Ö·ûµÄ¸öÊý½á¹ûΪ
select datalength('222')
--¼ÆËã×Ö½ÚÊý£¬½á¹ûΪ
select datalength(N'222')
-- unicodeÀàÐÍ£¬Õ¼Óøö×Ö½Ú£¬½á¹ûΪ
select substring('abcde',1,3)
-- ¸ñʽ£ºsubstr ......