zzbb 发表于 2018-10-8 08:45:11

十、MySQL视图

mysql> SELECT * FROM information_schema.views \G;  
*************************** 1. row ***************************
  
       TABLE_CATALOG: def
  
      TABLE_SCHEMA: test
  
          TABLE_NAME: stu_glass
  
   VIEW_DEFINITION: select `test`.`student`.`id` AS `id`,`test`.`student`.`name` AS `name`,`test`.`stu_info`.`glass` AS `glass` from `test`.`student` join `test`.`stu_info` where (`test`.`student`.`id` = `test`.`stu_info`.`id`)
  
      CHECK_OPTION: NONE
  
      IS_UPDATABLE: YES
  
             DEFINER: root@localhost
  
       SECURITY_TYPE: DEFINER
  
CHARACTER_SET_CLIENT: utf8
  
COLLATION_CONNECTION: utf8_general_ci
  
*************************** 2. row ***************************
  
       TABLE_CATALOG: def
  
      TABLE_SCHEMA: test
  
          TABLE_NAME: view_t
  
   VIEW_DEFINITION: select `test`.`t`.`qty` AS `qty`,`test`.`t`.`price` AS `price`,(`test`.`t`.`qty` * `test`.`t`.`price`) AS `qty *price` from `test`.`t`
  
      CHECK_OPTION: NONE
  
      IS_UPDATABLE: YES
  
             DEFINER: root@localhost
  
       SECURITY_TYPE: DEFINER
  
CHARACTER_SET_CLIENT: utf8
  
COLLATION_CONNECTION: utf8_general_ci
  
*************************** 3. row ***************************
  
       TABLE_CATALOG: def
  
      TABLE_SCHEMA: test
  
          TABLE_NAME: view_t2
  
   VIEW_DEFINITION: select `test`.`t`.`qty` AS `qty`,`test`.`t`.`price` AS `price`,(`test`.`t`.`qty` * `test`.`t`.`price`) AS `total` from `test`.`t`
  
      CHECK_OPTION: NONE
  
      IS_UPDATABLE: YES
  
             DEFINER: root@localhost
  
       SECURITY_TYPE: DEFINER
  
CHARACTER_SET_CLIENT: utf8
  
COLLATION_CONNECTION: utf8_general_ci
  
3 rows in set (0.00 sec)
  
ERROR:
  
No query specified


页: [1]
查看完整版本: 十、MySQL视图