数据库
首页 > 数据库> > alter table error ERROR 1347(HY000):’table-name’不是mysql中的BASE TABLE

alter table error ERROR 1347(HY000):’table-name’不是mysql中的BASE TABLE

作者:互联网

最近我试图在我的数据库的一个表中添加一个列,该表有316个表但是在以下命令之后:

mysql> ALTER TABLE view_Server ADD rsh_protocol VARCHAR(60);

我收到以下错误:

ERROR 1347 (HY000): 'itop.view_Server' is not BASE TABLE

我所有的搜索都没有成功,比如使用’“’.所以问题是这个错误的原因是什么?我怎么能骑这个?

解决方法:

从“表”名称,您是否尝试向视图添加列?

贯穿其中的每一个:

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;

标签:mysql,alter-table
来源: https://codeday.me/bug/20190623/1272297.html