无法删除mySQL表. (错误1050) [英] Can't delete a mySQL table. (Error 1050)

查看:445
本文介绍了无法删除mySQL表. (错误1050)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个令人讨厌的表,该表不会删除,并且阻止了我的开发环境刷新:(

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)

感觉很傻.

推荐答案

从名称上看,它可能是一个视图.尝试使用 DROP VIEW :

Judging from the name it might be a view. Try using 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

这篇关于无法删除mySQL表. (错误1050)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆