Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL server 2005ѧϰ±Ê¼Ç(ÊÓͼ)


Ò»£®ÊÓͼ(VIEW)
¶¨Ò壺ÊÓͼÊÇÒ»ÕÅÐéÄâµÄ±í£¬ÆäÄÚÈÝÊÇ´ÓÒ»ÕÅ»ò¶àÕűíÖвéѯµÃÀ´µÄ½á¹û¼¯¡£
ÃèÊö£ºÊÓͼÊÇ´æ´¢ÔÚϵͳĿ¼ÖеÄÐÅÏ¢£¬Ëý²¢Ã»ÓÐÕæÕý´æ´¢Êý¾Ý£¬¶øÊÇÒÑ´æ±íµÄͶӰ¡£ÊÓͼµÄÊôÐÔÊÇ°´ÕÕÒ»¸ö²éѯµÄ¹æ¶¨´ÓÒ»¸ö»òÕ߶à¸ö±íÖе¼³öµÄ£¬ÊÇÒÑ´æ±íµÄ¹ýÂËÆ÷¡£ËýÊÇÒ»ÕÅ“Ðé±í”£¬´ÓÒ»Õűí»òÕ߶àÕűíÖÐÅÉÉú³öÀ´µÄ£¬ÆäÀ´Ô´³ÆΪ“»ù±í”£¬Ò²¿ÉÒÔ˵ÊÓͼÊÇÒ»ÕÅ“ÅÉÉú±í”¡£
×÷ÓãºÓû§¸ü¾ß×Ô¼ºÐèÒª£¬½¨Á¢ÊÓͼ¡£ÕâÑù¾Í¹ýÂ˵ôÁËÄÇЩ²»³£ÓûòÕßÓû§²»ÐèÒªµÄÊý¾Ý£¬ÈÃÓû§µÄ²Ù×÷¸ü¼ÓѸËÙ¡£ÆäÓŵ㣺
1.½µµÍÊý¾Ý¿âµÄ¸´ÔÓÐÔ¡£
2.¼¯ÖÐÓû§Êý¾Ý¡£
3.¼òµ¥¹ÜÀí¡£
4.×éÖ¯Êý¾ÝתÒƵ½ÆäËûÓ¦ÓóÌÐò¡£
5.Êý¾Ý±£ÃÜ¡£
¶þ£®ÊÓͼ½¨Á¢
CREATE  VIEW <ÊÓͼÃû> [(<ÁÐÃû>[,<ÁÐÃû>]......)]
AS  <×Ó²éѯ>
[WITH  CHECK  OPTION]
×Ó²éѯ¿ÉÒÔÊÇÈÎÒ⸴ÔÓµÄSELECTÓï¾ä£¬µ«ÊÇ×Ó²éѯÖв»ÄÜ°üÀ¨ORDER  BYºÍDISTINCTÓï¾ä¡£
WITH  CHECK  OPTION ±íʾ¶ÔÊÓͼ½øÐÐUPTATA£¬INSERTºÍDELETE²Ù×÷ʱҪ±£Ö¤¸üС¢²åÈëºÍɾ³ýµÄÐÐÂú×ãÊÓͼ¶¨ÒåÖеÄΪ´ËÌõ¼þ(¼´×Ó²éѯÖеıí´ïʽ)¡£
Èý£®ÊÓͼ¹ÜÀí
1£®ÖØÃüÃûÊÓͼ
ʵÏÖ·½Ê½ÓÐÁ½ÖÖ£º
    (1)ͨ¹ý sp_name
     ¸ñʽ£ºsp_name <Ô­ÊÓͼÃû>,<ÐÂÊÓͼÃû>
×¢Ò⣺´Ë²Ù×÷±ØÐëÔÚµ±Ç°Êý¾Ý¿âÖУ¬Ö»ÓÐÊý¾Ý¿âÓµÓÐÕߺ͹ÜÀíÕß²ÅÄܶÔÊÓͼ¸üÃû¡£
(2)ͨ¹ý¹ÜÀíÆ÷½øÐиüÃû¡£
2.ÊÓͼÐÞ¸Ä
¸ñʽ£º
      ALTER VIEW <ÊÓͼÃû>
      AS 
         SELECT ²éѯÓï¾ä
         [WITH  CHECK  OPTION]
    3.ɾ³ýÊÓͼ
     ¸ñʽ£º
           DROP  VIEW  <ÊÓͼÃû>
×¢Ò⣺ÔÚɾ³ýÊÓͼºó£¬´ÓÕâ¸öÊÓͼÅÉÉú³öÀ´µÄÊÓͼ×Ô¶¯É¾³ý£¬µ«É¾³ýij¸ö±íºó£¬»ùÓÚÕâ¸ö±í´´½¨µÄÊÓͼ²»ÄÜ×Ô¶¯É¾³ý¡£
ËÄ£®ÊÓͼӦÓÃ
ÊÓͼӦÓõÄÔ¼Êø£¬ÏÂÁÐÇé¿öϲ»ÄܶÔÊÓͼ½øÐвÙ×÷£º
1.ÊÓͼÊôÐÔÀ´×Ô¾Û¼¯º¯Êý»òÕß°üº¬±í´ïʽ¡¢³£Á¿¡£
2.ÊÓÍ


Ïà¹ØÎĵµ£º

sql server ±í½á¹¹Êý¾Ý×ÖµäµÄsqlÓï¾ä

SELECT TOP (100) PERCENT
CASE WHEN a.colorder = 1 THEN d .name ELSE '' END AS ±íÃû, CASE WHEN a.colorder = 1 THEN isnull(f.value, '')
ELSE '' END AS ±í˵Ã÷, a.colorder AS ×Ö¶ÎÐòºÅ, a.name AS ×Ö¶ÎÃû, CASE WHEN COLUMNPROPERTY(a.id, a.name, 'IsIdentity')
= 1 THEN '√' ELSE '' END AS ±êʶ, CA ......

MySQLµ¼³öºÍµ¼ÈëSQL½Å±¾

MySQLµ¼³öºÍµ¼ÈëSQL½Å±¾
µ¼³ösql½Å±¾£º
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > ´æ·ÅλÖÃ
mysqljump -u root -p test > c:\a.sql
µ¼Èësql½Å±¾£º
Òª½¨»·¾³±äÁ¿»òÕßÔÚbinµÄĿ¼Ï£¬mysqlÕâ¸öÃüÁî²ÅÄÜʶ±ð¡£
testÊÇÄãÒªµ¼½øÈ¥µÄÊý¾Ý¿âÃû×Ö£¬ÒªÌáÇ°½¨ºÃ~~
mysql -u Óû§Ãû -p Êý¾Ý¿âÃû < ´æ·ÅλÖÃ
mysqljump -u ro ......

vc+sqlÁ¬½Ó×Ö·û´®

1£©
#pragma warning(disable:4146)
#import "C:\Program Files\Common Files\System\ADO\msado15.dll"
named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF")
#pragma warning(default:4146)
using namespace ADODB;
2£©
#pragma warning(disable:4146) ......

SQL SEVERÓëORACLE µÄsqlÓï¾äÇø±ð

Êýѧº¯Êý£º
1.¾ø¶ÔÖµ
S:SELECT abs(-1) value
O:SELECT abs(-1) value from dual
2.È¡Õû(´ó)
S:SELECT ceiling(-1.001) value
O:SELECT ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:SELECT floor(-1.001) value
O:SELECT floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:SELECT cast(-1.002 as int) value
O ......

Éî¶È¶Ô±ÈOracleÓëSQL Server

Ò»°ãµÄ¹«Ë¾Í¨³£»áÔÚËûÃǵÄÐÅϢϵͳ¼Ü¹¹ÖÐÒýÈë¶àÖÖÊý¾Ý¿âƽ̨£¬Í¬Ê±ÒýÈëÈýµ½ËÄÖÖ²»Í¬µÄRDBMS½â¾ö·½°¸µÄÖдóÐ͹«Ë¾Ò²²¢²»ÉÙ¼û£¬µ±È»ÕâЩ¹«Ë¾ÀïÃæµÄDBAÃÇͨ³£Ò²ÐèҪͬʱӵÓйÜÀí¶àÖÖ²»Í¬Æ½Ì¨µÄ¼¼ÄÜÁË¡£
Ö»ÔÚÒ»ÖÖƽ̨ÉÏÕ¹¿ª¹¤×÷µÄÊý¾Ý¿âר¼ÒÃÇҲͨ³£»áÆÚ´ý×ÅÔÚËûÃǵÄÏÂÒ»·Ý¹¤×÷ÖÐÄÜѧµ½µã²»Ò»ÑùµÄ¶«Î÷£¬ÄÇЩÓÐÓÂÆøµÄÈËÃÇÔòÔ¸Òâ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ