ÔÚsqlÖн¨ÉèÊÓͼÓÃʲôÏÂÁî
ÔÚ sql ÖУ¬Ê¹Óà create view Óï¾ä½¨ÉèÊÓͼ£¬Ó﷨Ϊ£ºÃüÃûÊÓͼ£ºÊÓͼÃû³Æºó¸ú as½ç˵×ÓÅÌÎÊ£ºas Òªº¦×ÖºóÖ¸¶¨×÷ΪÊÓͼ»ù´¡µÄ×ÓÅÌÎÊ
ÔÚ SQL Öн¨ÉèÊÓͼµÄÏÂÁî
ÔÚ SQL ÖУ¬¿ÉÒÔʹÓà CREATE VIEW Óï¾äÀ´½¨ÉèÊÓͼ¡£
Óï·¨
CREATE VIEW ÊÓͼÃû AS ×ÓÅÌÎÊ
°ì·¨
ÃüÃûÊÓͼ£ºÊ¹Óà ÊÓͼÃû Ö¸¶¨Òª½¨ÉèµÄÊÓͼµÄÃû³Æ¡£
½ç˵×ÓÅÌÎÊ£ºÔÚ AS Òªº¦×ÖºóÖ¸¶¨Òª×÷ΪÊÓͼ»ù´¡µÄ×ÓÅÌÎÊ¡£×ÓÅÌÎÊ¿ÉÒÔ°üÀ¨ SELECT Óï¾äÒÔ¼°ÆäËû SQL ²Ù×÷¡£
ʾÀý
ÒÔÏÂÓï¾ä½¨ÉèÒ»¸öÃûΪ customer_view µÄÊÓͼ£¬¸ÃÊÓͼ°üÀ¨¿Í»§±íÖпͻ§ÐÕÃûºÍµØµã£º
CREATE VIEW customer_view AS SELECT customer_name, address FROM customers;
µÇ¼ºó¸´ÖÆ
×¢ÖØÊÂÏî
ÊÓͼֻÊǶԻù´¡±íÊý¾ÝµÄÐéÄ⻯£¬²»»á´æ´¢ÏÖʵÊý¾Ý¡£
ÊÓͼ¿ÉÒÔÒýÓÃÆäËûÊÓͼ»ò±í¡£
¸ü¸Ä»ù´¡±íÖеÄÊý¾ÝÒ²»áÓ°ÏìÊÓͼÖеÄÊý¾Ý¡£
ÊÓͼ¿ÉÒÔÓÃÀ´Ìá¸ßÐÔÄÜ£¬ÓÉÓÚËüÃÇ¿ÉÒÔÔ¤ÏÈÅÌËã³£¼ûÅÌÎʵÄЧ¹û¡£
ÒÔÉϾÍÊÇÔÚsqlÖн¨ÉèÊÓͼÓÃʲôÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡