无法删除 mySQL 表。 (错误1050)

发布于 2024-09-02 17:11:59 字数 1630 浏览 11 评论 0原文

我有一个讨厌的表,不会删除,它阻碍了我的开发环境刷新:(

我知道这个表存在。示例...

mysql> select * from uc_order_products_qty_vw limit 10;
+-----+-------------+---------+---------+---------+---------+
| nid | order_count | avg_qty | sum_qty | max_qty | min_qty |
+-----+-------------+---------+---------+---------+---------+
| 105 |           1 |  1.0000 |       1 |       1 |       1 | 
| 110 |           5 |  1.0000 |       5 |       1 |       1 | 
| 111 |           1 |  1.0000 |       1 |       1 |       1 | 
| 113 |           5 |  1.0000 |       5 |       1 |       1 | 
| 114 |           1 |  1.0000 |       1 |       1 |       1 | 
| 115 |           1 |  1.0000 |       1 |       1 |       1 | 
| 117 |           2 |  1.0000 |       2 |       1 |       1 | 
| 119 |           3 |  1.3333 |       4 |       2 |       1 | 
| 190 |           5 |  1.0000 |       5 |       1 |       1 | 
| 199 |           2 |  1.0000 |       2 |       1 |       1 | 
+-----+-------------+---------+---------+---------+---------+
10 rows in set (0.00 sec)

但是当我尝试删除它时...

mysql> DROP TABLE IF EXISTS uc_order_products_qty_vw;
Query OK, 0 rows affected, 1 warning (0.00 sec)

它不起作用,该表仍然在那里,警告是这样的……

mysql> show warnings limit 1;
+-------+------+------------------------------------------+
| Level | Code | Message                                  |
+-------+------+------------------------------------------+
| Note  | 1051 | Unknown table 'uc_order_products_qty_vw' | 
+-------+------+------------------------------------------+
1 row in set (0.00 sec)

感觉很傻眼。

I have a pesky table that will not delete and it's holding up my dev environment refresh :(

I know this table exists. Example...

mysql> select * from uc_order_products_qty_vw limit 10;
+-----+-------------+---------+---------+---------+---------+
| nid | order_count | avg_qty | sum_qty | max_qty | min_qty |
+-----+-------------+---------+---------+---------+---------+
| 105 |           1 |  1.0000 |       1 |       1 |       1 | 
| 110 |           5 |  1.0000 |       5 |       1 |       1 | 
| 111 |           1 |  1.0000 |       1 |       1 |       1 | 
| 113 |           5 |  1.0000 |       5 |       1 |       1 | 
| 114 |           1 |  1.0000 |       1 |       1 |       1 | 
| 115 |           1 |  1.0000 |       1 |       1 |       1 | 
| 117 |           2 |  1.0000 |       2 |       1 |       1 | 
| 119 |           3 |  1.3333 |       4 |       2 |       1 | 
| 190 |           5 |  1.0000 |       5 |       1 |       1 | 
| 199 |           2 |  1.0000 |       2 |       1 |       1 | 
+-----+-------------+---------+---------+---------+---------+
10 rows in set (0.00 sec)

However when I try to drop it...

mysql> DROP TABLE IF EXISTS uc_order_products_qty_vw;
Query OK, 0 rows affected, 1 warning (0.00 sec)

It doesn't work, the table is still there, and the warning says this...

mysql> show warnings limit 1;
+-------+------+------------------------------------------+
| Level | Code | Message                                  |
+-------+------+------------------------------------------+
| Note  | 1051 | Unknown table 'uc_order_products_qty_vw' | 
+-------+------+------------------------------------------+
1 row in set (0.00 sec)

Feeling pretty dumbfounded.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷鸟归林 2024-09-09 17:11:59

从名字来看,可能是一种景观。尝试使用 DROP VIEW

DROP VIEW uc_order_products_qty_vw

DROP TABLE 不适用于视图:

CREATE VIEW test_vw AS SELECT 1;
SELECT * FROM test_vw;    -- works
DROP TABLE test_vw;       -- error: Unknown table 'test_vw'
DROP VIEW test_vw;        -- works

Judging from the name it might be a view. Try using DROP VIEW:

DROP VIEW uc_order_products_qty_vw

DROP TABLE doesn't work for views:

CREATE VIEW test_vw AS SELECT 1;
SELECT * FROM test_vw;    -- works
DROP TABLE test_vw;       -- error: Unknown table 'test_vw'
DROP VIEW test_vw;        -- works
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文