SQLÊý¾ÝÀàÐÍ
Êý¾ÝÀàÐÍ:
Ò»¡¢ ÕûÊýÊý¾ÝÀàÐÍ
INT(INTEGER) 4
SMALLINT 2
TINYINT 1
BIGINT 8
¶þ¡¢ ¸¡µãÊý¾ÝÀàÐÍ
REAL ¾«È·µ½µÚ7 λСÊý 4
FLOAT ¾«È·µ½µÚ15 λСÊý 8
DECIMAL ¿ÉÒÔÌṩСÊýËùÐèÒªµÄʵ¼Ê´æ´¢¿Õ¼ä 2-17 decimal[p,[s]] decimal(6,2)
p ±íʾ¿É¹©´æ´¢µÄÖµµÄ×ÜλÊý£¨²»°üÀ¨Ð¡Êýµã£©£¬È±Ê¡ÖµÎª18£» s ±íʾСÊýµãºóµÄλÊý£¬È±Ê¡ÖµÎª0
NUMERIC ÓëDECIMALÊý¾ÝÀàÐÍÍêÈ«Ïàͬ
Èý¡¢¶þ½øÖÆÊý¾ÝÀàÐÍ
BINARY
VARBINARY BINARY(n) n ±íʾÊý¾ÝµÄ³¤¶È£¬È¡ÖµÎª1 µ½8000
ËÄ¡¢ Âß¼Êý¾ÝÀàÐÍ
BIT Õ¼ÓÃ1 ¸ö×ֽڵĴ洢¿Õ¼ä£¬ÆäֵΪ0 »ò1 ¡£Èç¹ûÊäÈë0 »ò1 ÒÔÍâµÄÖµ£¬½«±»ÊÓΪ1¡£ BIT ÀàÐͲ»Äܶ¨ÒåΪNULL Öµ£¨ËùνNULL ÖµÊÇÖ¸¿ÕÖµ»òÎÞÒâÒåµÄÖµ£©¡£
Îå¡¢×Ö·ûÊý¾ÝÀàÐÍ
CHAR CHAR ÀàÐÍ´æ´¢µÄÿ¸ö×Ö·ûºÍ·ûºÅÕ¼Ò»¸ö×ֽڵĴ洢¿Õ¼ä
NCHAR ²ÉÓÃUNICODE ±ê×¼×Ö·û¼¯,ËùÒÔËü±È·ÇUNICODE ±ê×¼µÄÊý¾ÝÀàÐͶàÕ¼ÓÃÒ»±¶µÄ´æ´¢¿Õ¼ä
VARCHAR
NVARCHAR
char=====>¹Ì¶¨³¤¶È char(10) Õ¼Ò»¸ö×Ö½Ú
varchar=====>¿É±ä³¤¶È varchar(10)
nchar====>unicode Õ¼Á½¸ö×Ö½Ú
Áù¡¢Îı¾ºÍͼÐÎÊý¾ÝÀàÐÍ
TEXT ÓÃÓÚ´æ´¢´óÁ¿Îı¾Êý¾Ý
NTEXT ²ÉÓÃUNICODE
IMAGE ´æ´¢Êý¾ÝµÄģʽÓëTEXT Êý¾ÝÀàÐÍÏàͬ ÓÃÓÚ´æ´¢´óÁ¿µÄ¶þ½øÖÆÊý¾Ý
address nvarchar(50)
introduct ntext
Æß ÈÕÆÚºÍʱ¼äÊý¾ÝÀàÐÍ
DATETIME
Ïà¹ØÎĵµ£º
´Ó²©¿ÍÔ°Öп´µ½Ò»ÆªÎÄÕ£¬½éÉÜ´óÈí¼þ¹«Ë¾ÃæÊÔʱ³£³£»á³öµÄÁ½µÀSQLÌ⣨¼û¸½Â¼£©¡£
ÎÒ¾õµÃÊÜÒæºÜ¶à£¬ÔÚ´Ë֮ǰ£¬ÎÒÒ»Ö±¾õµÃ£¬SQL2008ËƺõÌṩÁËÕâ·½ÃæµÄÖ§³Ö£¬µ«¸üµÍµÄ°æ±¾£¬°üÀ¨2005£¬·ÇÓαê×ö²»³öÀ´£¨Ë®Æ½¹»²Ë£©¡£×ܽáÐĵÃÈçÏ£º
1¡¢ Ç¿´óµÄgroup by
1 select stdname,
2 isnull( ......
дSQLµÄ±Èд.NET³ÌÐòµÄÌåÑéÉϲîÒ»µÈ£¬Ã»ÓÐÖÇÄÜÌáʾ£¬ÐèÒª¼Çס¹Ø¼ü×Ö£¬º¯Êý»òÕß²»¶ÏµØCopy±í×Ö¶ÎÃû£¬×Ô¶¨Ò庯Êý£¬´æ´¢¹ý³ÌÖ®ÀàµÄ¡£²»¹ýÔÚ
VS2010ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÖÇÄÜÌáʾÁË£¬ÈçÏÂÃ漸·ùͼËùʾ£º
ÔÚ±à¼Æ÷ÖУ¬ ÊäÈë Shift + J
£¨Ìáʾ£º VS2010 ¿ª·¢¹¤¾ßÖбêµÄÊÇ Ctrl +J ÆäʵӦ¸ÃÊÇ Shift + J £©¾Í¿ÉÒÔ×Ô¶¯´ò¿ªÕâ¸öÖÇ ......
inner join(µÈÖµÁ¬½Ó) Ö»·µ»ØÁ½¸ö±íÖÐÁª½á×Ö¶ÎÏàµÈµÄÐÐ
left join(×óÁª½Ó) ·µ»Ø°üÀ¨×ó±íÖеÄËùÓмǼºÍÓÒ±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
right join(ÓÒÁª½Ó) ·µ»Ø°üÀ¨ÓÒ±íÖеÄËùÓмǼºÍ×ó±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
INNER JOIN Óï·¨£º
INNER JOIN Á¬½ÓÁ½¸öÊý¾Ý±íµÄÓ÷¨£º
SELECT * from ±í1 INNER JOIN ±í2 ON ±í1.×ֶκÅ=±í2 ......
±¾ÎÄÀ´×Ô£ºhttp://zhidao.baidu.com/question/27978123.html?si=1
ÕâЩÊÇ SQL-92 ÉèÖÃÓï¾ä£¬Ê¹ SQL Server 2000/2005 ×ñ´Ó SQL-92 ¹æÔò¡£
µ± SET QUOTED_IDENTIFIER Ϊ ON ʱ£¬±êʶ·û¿ÉÒÔÓÉË«ÒýºÅ·Ö¸ô£¬¶øÎÄ×Ö±ØÐëÓɵ¥ÒýºÅ·Ö¸ô¡£µ± SET QUOTED_IDENTIFIER Ϊ OFF ʱ£¬±êʶ·û²»¿É¼ÓÒýºÅ£¬ÇÒ±ØÐë·ûºÏËùÓÐ Transact-SQL ±êÊ ......