最近,我试图在我的数据库的一个表中添加一个列,该表有316个表但是在以下命令之后:
mysql> ALTER TABLE view_Server ADD rsh_protocol VARCHAR(60);
我收到以下错误:
ERROR 1347 (HY000): 'itop.view_Server' is not BASE TABLE
我的所有搜索都没有成功,例如使用'``'
。所以问题是这个错误的原因是什么?我该怎么办呢?
答案 0 :(得分:4)
从“桌面”名称,您是否尝试向视图添加列?
贯穿以下各项:
CREATE TABLE x (id INT, name VARCHAR(255));
INSERT INTO x VALUES (1, 'One');
INSERT INTO x VALUES (2, 'Two');
-- A view with no change of column names
CREATE VIEW y AS SELECT id FROM x;
SELECT * FROM y;
-- Change the view, again using the base table column names
ALTER VIEW y AS SELECT name FROM x;
SELECT * FROM y;
-- Change the view, switching column name from `name` to `theName`
ALTER VIEW y (theName) AS SELECT name FROM x;
SELECT * FROM y;
-- Change the view, switching column name to `anotherName` by aliasing in the SELECT
ALTER VIEW y AS SELECT name anotherName FROM x;
SELECT * FROM y;