视图上无法创建索引

mysql> create view v_test as select * from test;
Query OK, 0 rows affected (0.15 sec)

mysql> desc v_test;
+-------+----------+------+-----+---------+-------+
| Field | Type     | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id    | int(11)  | YES  |     | NULL    |       |
| name  | char(10) | YES  |     | NULL    |       |
+-------+----------+------+-----+---------+-------+
2 rows in set (0.07 sec)

mysql> create index v_test_idx1 on v_test(id);
ERROR 1347 (HY000): 'zjzc.v_test' is not BASE TABLE

转载于:https://www.cnblogs.com/zhaoyangjian724/p/6199919.html

你可能感兴趣的:(视图上无法创建索引)