MySqlÖд´½¨ÊÓͼ
CREATE [OR REPLACE] [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
VIEW view_name [(column_list)]
AS select_statement
[WITH [CASCADED | LOCAL] CHECK OPTION]
¸ÃÓï¾äÄÜ´´½¨ÐµÄÊÓͼ£¬Èç¹û¸ø¶¨ÁËOR REPLACE×Ӿ䣬¸ÃÓï¾ä»¹ÄÜÌæ»»ÒÑÓеÄÊÓͼ¡£select_statementÊÇÒ»ÖÖSELECTÓï¾ä£¬Ëü¸ø³öÁËÊÓͼµÄ¶¨Òå¡£¸ÃÓï¾ä¿É´Ó»ù±í»òÆäËûÊÓͼ½øÐÐÑ¡Ôñ¡£
¸ÃÓï¾äÒªÇó¾ßÓÐÕë¶ÔÊÓͼµÄCREATE VIEWȨÏÞ£¬ÒÔ¼°Õë¶ÔÓÉSELECTÓï¾äÑ¡ÔñµÄÿһÁÐÉϵÄijЩȨÏÞ¡£¶ÔÓÚÔÚSELECTÓï¾äÖÐÆäËûµØ·½Ê¹ÓõÄÁУ¬±ØÐë¾ßÓÐSELECTȨÏÞ¡£Èç¹û»¹ÓÐOR REPLACE×Ӿ䣬±ØÐëÔÚÊÓͼÉϾßÓÐDROPȨÏÞ¡£
ÊÓͼÊôÓÚÊý¾Ý¿â¡£ÔÚĬÈÏÇé¿öÏ£¬½«ÔÚµ±Ç°Êý¾Ý¿â´´½¨ÐÂÊÓͼ¡£ÒªÏëÔÚ¸ø¶¨Êý¾Ý¿âÖÐÃ÷È·´´½¨ÊÓͼ£¬´´½¨Ê±£¬Ó¦½«Ãû³ÆÖ¸¶¨Îªdb_name.view_name¡£
mysql> CREATE VIEW test.v AS SELECT * from t;
±íºÍÊÓͼ¹²ÏíÊý¾Ý¿âÖÐÏàͬµÄÃû³Æ¿Õ¼ä£¬Òò´Ë£¬Êý¾Ý¿â²»ÄÜ°üº¬¾ßÓÐÏàͬÃû³ÆµÄ±íºÍÊÓͼ¡£
ÊÓͼ±ØÐë¾ßÓÐΨһµÄÁÐÃû£¬²»µÃÓÐÖظ´£¬¾ÍÏñ»ù±íÄÇÑù¡£Ä¬ÈÏÇé¿öÏ£¬ÓÉSELECTÓï¾ä¼ìË÷µÄÁÐÃû½«ÓÃ×÷ÊÓͼÁÐÃû¡£ÒªÏëΪÊÓͼÁж¨ÒåÃ÷È·µÄÃû³Æ£¬¿ÉʹÓÿÉÑ¡µÄcolumn_list×Ӿ䣬ÁгöÓɶººÅ¸ô¿ªµÄID¡£column_listÖеÄÃû³ÆÊýÄ¿±ØÐëµÈÓÚSELECTÓï¾ä¼ìË÷µÄÁÐÊý¡£
SELECTÓï¾ä¼ìË÷µÄÁпÉÒÔÊǶԱíÁеļòµ¥ÒýÓá£Ò²¿ÉÒÔÊÇʹÓú¯Êý¡¢³£Á¿Öµ¡¢²Ù×÷·ûµÈµÄ±í´ïʽ¡£
¶ÔÓÚSELECTÓï¾äÖв»ºÏ¸ñµÄ±í»òÊÓͼ£¬½«¸ù¾ÝĬÈϵÄÊý¾Ý¿â½øÐнâÊÍ¡£Í¨¹ýÓÃÇ¡µ±µÄÊý¾Ý¿âÃû³ÆÏÞ¶¨±í»òÊÓͼÃû£¬ÊÓͼÄܹ»ÒýÓñí»òÆäËûÊý¾Ý¿âÖеÄÊÓͼ¡£
Äܹ»Ê¹ÓöàÖÖSELECTÓï¾ä´´½¨ÊÓͼ¡£ÊÓͼÄܹ»ÒýÓûù±í»òÆäËûÊÓͼ¡£ËüÄÜʹÓÃÁªºÏ¡¢UNIONºÍ×Ó²éѯ¡£SELECTÉõÖÁ²»ÐèÒýÓÃÈÎºÎ±í¡£ÔÚÏÂÃæµÄʾÀýÖУ¬¶¨ÒåÁË´ÓÁíÒ»±íÑ¡ÔñÁ½ÁеÄÊÓͼ£¬²¢¸ø³öÁ˸ù¾ÝÕâЩÁмÆËãµÄ±í´ïʽ£º
mysql> CREATE TABLE t (qty INT, price INT);
mysql> INSERT INTO t VALUES(3, 50);
mysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value from t;
mysql> SELECT * from v;
+------+-------+-------+
| qty | price | value |
+------+-------+-------+
| 3 | 50 | 150 |
+------+-------+-------+
ÊÓͼ¶¨Òå·þ´ÓÏÂÊöÏÞÖÆ£º
· SELECTÓï¾ä²»ÄÜ°üº¬from×Ó¾äÖеÄ×Ó²éѯ¡£
·
Ïà¹ØÎĵµ£º
<!--#include file="zheboconn.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>aspºÍmysql·ÖÒ³´úÂë</title>
<style type="text/css">
<!--
.STYLE3 {
fon ......
жÔØMysql
[root@localhost ~]# rpm -qa | grep mysql
mysql-3.23.58-9
php-mysql-4.3.4-11
mod_auth_mysql-20030510-4.1
mysql-server-3.23.58-9
˵Ã÷£ºrpm –qa | grep mysql ÃüÁîÊÇΪÁË°ÑmysqlÏà¹ØµÄ°ü¶¼ÁгöÀ´£¬Ð¶Ôض¼´Ó×îÏÂÃæµÄÒ»¸ö°ü¿ªÊ¼£¬Ö±µ½Ð¶ÔصôµÚÒ»¸öΪֹ¡£Ö´ÐÐrpm -q php£¬Èç¹û·µ»Øphp°æ±¾£¬ ......
¹Ø¼ü×Ö: mysql6 mysql6ÏÂÔØ
×÷ΪһÃû¿ª·¢ÈËÔ±,ÎÒ¶ÔÂÌɫСÈí¼þÇéÓжÀÖÓ,ÒòΪÓÃÆðÀ´·½±ã¿ì½ÝÂï,±ãÓÚЯ´ø,Ò×ÓÚÔÚÑÝʾϵͳÖÐʹÓÃ,¿ª·¢Ê±¿ÉÁ¢¼´½øÈë״̬. £¨ÔÚ¸½¼þÖУ©
ÒÔÏÂÊÇÏêϸ˵Ã÷:
MySQL 6 ÂÌÉ«¾«¼ò°æ(BAT°æ±¾)
MySQL 6 Ö§³ÖÍâ¼ü,ÊÓͼ´æ´¢¹ý³Ì,ÊÂÎñµÈ¹¦ÄÜ(ÂÌÉ«¾« ......
ÓÉÓÚ×î½üÒ»Ö±ÔÚÁ˽âmysql¡£¸÷ÖÖ±íÀàÐ͵ÄÊý¾Ý´æ´¢ÒÔ¼°Ïà¹ØÏÞÖƾÍÊDZØÐëÁ˽âµÄ·½ÃæÁË¡£
×Ô¼ºµÄ·þÎñÆ÷»·¾³£ºOS Cent OS ext3£¬memory 4G£¬ disk 2T block size 4K¡£
¾µ÷²é£¬linuxÏÂÎļþ×î´óÊÇ´æÔÚÏÞÖƵġ£È¥googleÉÏËÑÁËËÑ£¬´ó¼Ò˵·¨²»Ò»£¬×îÖÕ×Ô¼º»¹ÊÇÕÒµ½±È½Ï¹Ù·½µÄ˵¡£Ïê¼ûhttp://en.wikipedia.org/wiki/Ext3 ËùÒÔ× ......