SQL´óÈ«
SQL ÃüÁî
Õⲿ·Ö°üº¬ÄÇЩ PostgreSQL Ö§³ÖµÄ SQL ÃüÁîµÄÐÅÏ¢£®ÕâÀïµÄ "SQL" ¾ÍÊǸÃÓïÑÔͨ³£µÄº¬Ò壻 ÿÌõÃüÁîµÄÓë±ê×¼ÓйصļæÈÝÐÔµÄÐÅÏ¢¿ÉÒÔÔÚÏà¹ØµÄ²Î¿¼Ò³ÖÐÕÒµ½£®
Table of Contents
ABORT -- Í˳öµ±Ç°ÊÂÎñ
ALTER GROUP -- Ïò×éÖÐÔö¼ÓÓû§»ò´Ó×éÖÐɾ³ýÓû§
ALTER USER -- ¸Ä±äÊý¾Ý¿âÓû§Õʺţ®
ANALYZE -- ÊÕ¼¯ÓëÊý¾Ý¿âÓйصÄͳ¼Æ
BEGIN -- ¿ªÊ¼Ò»¸öÊÂÎñ¿é
CHECKPOINT -- Ç¿ÖÆÒ»¸öÊÂÎñÈÕÖ¾¼ì²éµã
CLOSE -- ¹Ø±ÕÒ»¸öÓαê
CLUSTER -- ¸ù¾ÝÒ»¸öË÷Òý¶Ôij¸ö±í¼¯´Ø
COMMENT -- ¶¨Òå»òÕ߸ıäÒ»¸ö¶ÔÏóµÄÆÀ×¢
COMMIT -- Ìá½»µ±Ç°ÊÂÎñ
COPY -- ÔÚ±íºÍÎļþÖ®¼ä¿½±´Êý¾Ý
CREATE AGGREGATE -- ¶¨ÒåÒ»¸öеľۼ¯º¯Êý
CREATE CONSTRAINT TRIGGER -- ¶¨ÒåÒ»¸öеÄÔ¼Êø´¥·¢Æ÷
CREATE DATABASE -- ´´½¨ÐÂÊý¾Ý¿â
CREATE FUNCTION -- ¶¨ÒåÒ»¸öк¯Êý
CREATE GROUP -- ¶¨ÒåÒ»¸öеÄÓû§×é
CREATE INDEX -- ¶¨ÒåÒ»¸öÐÂË÷Òý
CREATE LANGUAGE -- ¶¨ÒåÒ»ÖÖеĹý³ÌÓïÑÔ
CREATE OPERATOR -- ¶¨ÒåÒ»¸öеIJÙ×÷·û
CREATE RULE -- ¶¨ÒåÒ»¸öеÄÖØд¹æÔò
CREATE SEQUENCE -- ´´½¨Ò»¸öеÄÐòÁз¢ÉúÆ÷
CREATE TABLE -- ¶¨ÒåÒ»¸öбí
CREATE TABLE AS -- ´ÓÒ»Ìõ²éѯµÄ½á¹ûÖд´½¨Ò»¸öбí
CREATE TRIGGER -- ¶¨ÒåÒ»¸öеĴ¥·¢Æ÷
CREATE TYPE -- ¶¨ÒåÒ»¸öеÄÊý¾ÝÀàÐÍ
CREATE USER -- ´´½¨Ò»¸öеÄÊý¾Ý¿âÓû§ÕÊ»§
CREATE VIEW -- ¶¨ÒåÒ»¸öÊÓͼ
DECLARE -- ¶¨ÒåÒ»¸öÓαê
DELETE -- ɾ³ýÒ»¸ö±íÖеÄÐÐ
DROP AGGREGATE -- ɾ³ýÒ»¸öÓû§¶¨ÒåµÄ¾Û¼¯º¯Êý
DROP DATABASE -- ɾ³ýÒ»¸öÊý¾Ý¿â£®
DROP FUNCTION -- ɾ³ýÒ»¸öÓû§¶¨ÒåµÄº¯Êý
DROP GROUP -- ɾ³ýÒ»¸öÓû§×é
DROP INDEX -- ɾ³ýÒ»¸öË÷Òý
DROP LANGUAGE -- ɾ³ýÒ»¸öÓû§¶¨ÒåµÄ¹ý³ÌÓïÑÔ
DROP OPERATOR -- ɾ³ýÒ»¸öÓû§¶¨Òå²Ù×÷·û
DROP RULE -- ɾ³ýÒ»¸öÖØд¹æÔò
DROP SEQUENCE -- ɾ³ýÒ»¸öÐòÁÐ
DROP TABLE -- ɾ³ýÒ»¸ö±í
DROP TRIGGER -- ɾ³ýÒ»¸ö´¥·¢Æ÷¶¨Ò壮
DROP TYPE -- ɾ³ýÒ»¸öÓû§¶¨ÒåÊý¾ÝÀàÐÍ
DROP USER -- ɾ³ýÒ»¸öÊý¾Ý¿âÓû§ÕʺÅ
DROP VIEW -- ɾ³ýÒ»¸öÊÓͼ
END -- Ìá½»µ±Ç°µÄÊÂÎñ
EX
Ïà¹ØÎĵµ£º
ͨÅä·û ˵Ã÷
_ ÓëÈÎÒâµ¥×Ö·ûÆ¥Åä
% Óë°üº¬Ò»¸ö»ò¶à¸ö×Ö·ûµÄ×Ö·û´®Æ¥Åä
[ ] ÓëÌض¨·¶Î§£¨ÀýÈ磬[a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[abcdef]£©ÖеÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
[^] ÓëÌض¨·¶Î§£¨ÀýÈ磬[^a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[^abcdef]£©Ö®ÍâµÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£ ......
1. SQLÓÅ»¯µÄÔÔòÊÇ£º
½«Ò»´Î²Ù×÷ÐèÒª¶ÁÈ¡µÄBLOCKÊý¼õµ½×îµÍ,¼´ÔÚ×î¶ÌµÄʱ¼ä´ïµ½×î´óµÄÊý¾ÝÍÌÍÂÁ¿¡£
µ÷Õû²»Á¼SQLͨ³£¿ÉÒÔ´ÓÒÔϼ¸µãÇÐÈ룺
¼ì²é²»Á¼µÄSQL£¬¿¼ÂÇÆäд·¨ÊÇ·ñ»¹ÓпÉÓÅ»¯ÄÚÈÝ
¼ì²é×Ó²éѯ ¿¼ÂÇSQL×Ó²éѯÊÇ·ñ¿ÉÒÔÓüòµ¥Á¬½Óµ ......
Õª×Ôhttp://hi.baidu.com/dusongw/blog/item/4090493d6ec0cdee3d6d97a6.html
ÎÒ½«ÒÔ“°ì¹«×Ô¶¯»¯”ϵͳΪÀý£¬Ì½ÌÖÈçºÎÔÚÓÐ×Å1000ÍòÌõÊý¾ÝµÄMS SQL SERVERÊý¾Ý¿âÖÐʵÏÖ¿ìËÙµÄÊý¾ÝÌáÈ¡ºÍÊý¾Ý·ÖÒ³¡£ÒÔÏ´úÂë˵Ã÷ÁËÎÒÃÇʵÀýÖÐÊý¾Ý¿âµÄ“ºìÍ·Îļþ”Ò»±íµÄ²¿·ÖÊý¾Ý½á¹¹£º
CREATE TABL ......
´ÓÕâÒ»½Ú¿ªÊ¼ÄØ£¬ÎÒÃǾÍÒª¿ªÊ¼CLRµÄ±à³ÌÖ®ÂÃÁË¡£ÔÚÕâ֮ǰ£¬ÎÒÏȰѱ¾½ÚÖÐÐèÒªÁ˽âµÄÁ½¸öÐÂÀàSqlDataRecordºÍSqlMetaData£¬¼°Îå¸öз½·¨SqlContext.Pipe.SendResultsStart£¬SqlContext.Pipe.SendResultsRow£¬SqlContext.Pipe.SendResultsEnd£¬SqlContext.Pipe.SendºÍSqlContext.Pipe.ExecuteAndSend½øÐÐһϱØÒªµÄ˵Ã÷£¬·½±ã´ ......
In:µÈÖµÁ¬½Ó£¬ÓÃÀ´²éÕÒ¶à±íÏàͬ×ֶεļǼ
Not In:·ÇµÈÖµÁ¬½Ó£¬ÓÃÀ´²éÕÒ²»´æÔڵļǼ
Inner join:ÄÚÁ¬½Ó£¬Ö÷ÒªÓÃÀ´²éÕÒ¶¼·ûºÏÌõ¼þµÄ¼Ç¼
Left join:×óÁ¬½Ó£¬Ö÷ÒªÓÃÀ´²éÕÒ×ó±ßÓУ¬ÓÒ±ßûÓеÄÓÿÕÖµ±í´ï
Right join:ÓÒÁ¬½Ó£¬Ö÷ÒªÓÃÀ´²éÕÒÓÒ±ßÓУ¬×ó±ßûÓеÄÓÿÕÖµ±í´ï
Order By:ÉýÐò Asc ½µÐò Desc
Group By:·Ö×éÅÅÐò ......