¡¶£Ó£Ñ£Ì Óï·¨²Î¿¼ÊÖ²á(SQL)¡·
£Ó£Ñ£Ì Óï·¨²Î¿¼ÊÖ²á(SQL)/Êý¾ÝÀàÐÍ
DB2 ÌṩÁ˹ØÁ¬Ê½×ÊÁÏ¿âµÄ²éѯÓïÑÔ £Ó£Ñ£Ì (Structured Query Language)£¬ÊÇÒ»Öַdz£¿ÚÓﻯ¡¢¼ÈÒ×ѧÓÖÒ׶®µÄÓï·¨¡£´ËÒ»ÓïÑÔ¼¸ºõÊÇÿ¸ö×ÊÁÏ¿âϵͳ¶¼±ØÐëÌṩµÄ£¬ÓÃÒÔ±íʾ¹ØÁ¬Ê½µÄ*×÷£¬°üº¬ÁË×ÊÁϵĶ¨Ò壨£Ä£Ä£Ì£©ÒÔ¼°×ÊÁϵĴ¦Àí£¨£Ä£Í£Ì£©¡£SQLÔÀ´Æ´³ÉSEQUEL£¬ÕâÓïÑÔµÄÔÐÍÒԓϵͳ R“µÄÃû×ÖÔÚ IBM Ê¥ºÉÎ÷ʵÑéÊÒÍê³É£¬¾¹ýIBMÄÚ²¿¼°ÆäËûµÄÐí¶àʹÓÃÐÔ¼°Ð§ÂʲâÊÔ£¬Æä½á¹ûÏ൱ÁîÈËÂúÒ⣬²¢¾ö¶¨ÔÚϵͳR µÄ¼¼Êõ»ù´¡·¢Õ¹³öÀ´ IBM µÄ²úÆ·¡£¶øÇÒÃÀ¹ú¹ú¼Ò±ê׼ѧ»á£¨ANSI£©¼°¹ú¼Ê±ê×¼»¯×éÖ¯£¨ISO£©ÔÚ1987×ñÑÒ»¸ö¼¸ºõÊÇÒÔ IBM SQL Ϊ»ù´¡µÄ±ê×¼¹ØÁ¬Ê½×ÊÁÏÓïÑÔ¶¨Òå¡£
Ò»¡¢×ÊÁ϶¨Òå £Ä£Ä£Ì£¨Data Definition Language)
×ÊÁ϶¨ÓïÑÔÊÇÖ¸¶Ô×ÊÁϵĸñʽºÍÐÎ̬϶¨ÒåµÄÓïÑÔ£¬ËûÊÇÿ¸ö×ÊÁÏ¿âÒª½¨Á¢Ê±ºòʱÊ×ÏÈÒªÃæ¶ÔµÄ£¬¾Ù·²×ÊÁÏ·ÖÄÄЩ±í¸ñ¹Øϵ¡¢±í¸ñÄÚµÄÓÐʲ÷áÀ¸Î»Ö÷¼ü¡¢±í¸ñºÍ±í¸ñÖ®¼ä»¥Ïà²Î¿¼µÄ¹ØϵµÈµÈ£¬¶¼ÊÇÔÚ¿ªÊ¼µÄʱºòËù±ØÐë¹æ»®ºÃµÄ¡£
£±¡¢½¨±í¸ñ£º
Create TABLE table_name(
column1 DATATYPE [NOT NULL] [NOT NULL PRIMARY KEY],
column2 DATATYPE [NOT NULL],
...£©
˵Ã÷£º¡¡
DATATYPE --ÊÇ×ÊÁϵĸñʽ£¬Ïê¼û±í¡£
NUT NULL --¿É²»¿ÉÒÔÔÊÐí×ÊÁÏÓпյģ¨ÉÐδÓÐ×ÊÁÏÌîÈ룩¡£
PRIMARY KEY --ÊDZ¾±íµÄÖ÷¼ü¡£
£²¡¢¸ü¸Ä±í¸ñ¡¡
Alter TABLE table_name
ADD COLUMN column_name DATATYPE
˵Ã÷£ºÔö¼ÓÒ»¸öÀ¸Î»£¨Ã»ÓÐɾ³ýij¸öÀ¸Î»µÄÓï·¨¡£
Alter TABLE table_name
ADD PRIMARY KEY (column_name)
˵Ã÷£º¸ü¸Ä±íµÃµÄ¶¨Òå°Ñij¸öÀ¸Î»ÉèΪÖ÷¼ü¡£
Alter TABLE table_name
Drop PRIMARY KEY (column_name)
˵Ã÷£º°ÑÖ÷¼üµÄ¶¨Òåɾ³ý¡£
£³¡¢½¨Á¢Ë÷Òý¡¡
Create INDEX index_name ON table_name (column_name)
˵Ã÷£º¶Ôij¸ö±í¸ñµÄÀ¸Î»½¨Á¢Ë÷ÒýÒÔÔö¼Ó²éѯʱµÄËٶȡ£
£´¡¢É¾³ý¡¡
Drop table_name
Drop 
Ïà¹ØÎĵµ£º
¶¨Ê±ÖØÆôSQL ServerºÍTomcat
[http://hi.baidu.com/personnel/blog/item/020d5edf020a281248540306.html]
¶¨Ê±ÖØÆôSQL ServerºÍTomcat
2007-06-07 08:23
ÒÔǰûÓÐ×Ô¼º¹ÜÀí·þÎñÆ÷»¹²»ÖªµÀ£¬SQL Server·þÎñÆ÷µÄÄÚ´æËæ×ÅÔËÐеÄʱ¼äÔö³¤¶ø²»¶ÏÔö³¤¡£
ÓÃÁËÒ»Á½ÌìÖ®ºó·¢ÏÖ½ø³ÌÖеÄSQL ServerÒѾռÓÃÁ˽ü1.3GµÄÄڴ棬ÄÚ´æÒ»¹ ......
¡¡¡¡
¡¡¡¡¡ô¾¡Á¿²»ÒªÔÚwhereÖаüº¬×Ó²éѯ;
¡¡¡¡¹ØÓÚʱ¼äµÄ²éѯ£¬¾¡Á¿²»ÒªÐ´³É£ºwhere to_char(dif_date,'yyyy-mm-dd')=to_char('2007-07-01','yyyy-mm-dd');
¡¡¡¡¡ôÔÚ¹ýÂËÌõ¼þÖУ¬¿ÉÒÔ¹ýÂ˵ô×î´óÊýÁ¿¼Ç¼µÄÌõ¼þ±ØÐë·ÅÔÚwhere×Ó¾äµÄĩβ;
¡¡¡¡from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í£¬driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖа ......
´Ó²»Í¬µÄ½Ç¶È£¬ÎÒÃÇ¿ÉÒÔ°ÑSQL ServerÊý¾Ýƽ̨»®·ÖΪ¶à¸ö×é¼þ¡£ÎÒÃÇÏÂÃæ°´ÕÕSQL Server Internal Teamͨ³£µÄ»®·ÖÔÔò£¬°ÑSQL ServerÊý¾Ýƽ̨»®·ÖΪÈçÏ£º
SSAS: SQL Server Analysis Service¡£Ö÷ÒªÓÃÀ´×ö·ÖÎöÓ㬱ÈÈçCube£¬¿ÉÒÔ´Ó²»Í¬µÄ½Ç¶ÈÉóÊÓÊý¾Ý¡£
SSIS: SQL Server Integration Servi ......
UPDATe [Sale_Goods] SET [Catalog33_ID] = [Catalog].[ID]
from [Sale_Goods]
LEFT OUTER JOIN [chdy222] ON [Sale_Goods].[Code] = [chdy222].[ID]
LEFT OUTER JOIN [Catalog] ON [chdy222].[ufidaname] = [Catalog].[Name] and [Catalog].[Type]=33
WHERE [Catalog].[ID] IS NOT NULL ......