Can't DROP TABLE unknown table (ERROR 1051) - mysql

I want to remove a table, but when I execute DROP TABLE catalog_product_flat_1 I get:
ERROR 1051 (42S02): Unknown table 'catalog_product_flat_1'
When I run DROP VIEW catalog_product_flat_1 I get:
#1347 - 'magento.catalog_product_flat_1' is not VIEW
What am I missing?

Related

Why does DROP TABLE IF EXISTS cause a MySQL warning if the table doesn't exist?

Why does dropping a non-existent table IF EXISTS cause a warning?
CREATE DATABASE `test`;
USE `test`;
DROP TABLE IF EXISTS `nonexistent_table`;
SHOW WARNINGS;
Unknown table 'test.nonexistent_table'
Isn't the whole point of this statement to check if it exists first, and accept that it might not exist?
the different it it doesn't give you an error but just warning:
DROP TABLE IF EXISTS `nonexistent_table`;
SHOW WARNINGS;
✓
Level | Code | Message
:---- | ---: | :----------------------------------------------
Note | 1051 | Unknown table 'db_2134513036.nonexistent_table'
DROP TABLE `nonexistent_table`;
SHOW WARNINGS;
Unknown table 'db_2134513036.nonexistent_table'
db<>fiddle here
as you see first statement runs successfully but second one fails.

Unknown column but colum exists in view

I have created a view which contains field 'Spieltag'. Here you can see my view...
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`#`localhost`
SQL SECURITY DEFINER
VIEW `auswärtsergebnisse` AS
SELECT
`bundesligaergebnisse`.`Spieltag` AS `Spieltag`,
`bundesligaergebnisse`.`Heimteam` AS `Heimteam`,
`bundesligaergebnisse`.`Heimtore` AS `Heimtore`
FROM
`bundesligaergebnisse`
But when I run SELECT Spieltag FROM analytics.auswärtsergebnisse;
I get Error Code 1054, Unknown field 'Spieltag' in 'field list'. With Heimteam and Heimtore is everything fine and select * works fine.

ERROR 1030 (HY000): Got error 168 from storage engine

Had a drive crash and recovered my mysql databases from backup. One table didn't make it and I deleted it and its associated files. (InnoDB table.) The table name was "filescan" and there are now no files in the data directory with that root name.
I am able to create and delete other table names, but not "filescan". When I try that, I get an error.
mysql> create table deleteme (id int);
Query OK, 0 rows affected (0.20 sec)
mysql> create table filescan(id int);
ERROR 1030 (HY000): Got error 168 from storage engine
mysql> drop table deleteme
-> ;
Query OK, 0 rows affected (0.03 sec)
mysql> drop table filescan;
ERROR 1051 (42S02): Unknown table 'db1.filescan'
mysql> create table filescan(id int);
ERROR 1030 (HY000): Got error 168 from storage engine
mysql>
Other answers on Stack Exchange and elsewhere seem to indicate this happens when there's a shortage of disk space. I have 130GB+ free and am able to create other tables - just not one named "filescan". I thought it might be a permissions issue, so I checked the permissions of the other files and the enclosing /data folder to ensure I have access.
Any insights?

"table or view does not exist" but it does

user1:
grant select on user1.view1 to user2;
grant succeeded
user2:
CREATE TABLE user2.table1 as SELECT * FROM user1.view1;
ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
*Cause:
*Action:
Error at Line: 1 Column: 46
Does anyone know why the SELECT * FROM user1.view1; doesn't work for this view, but I can do it for the other views and tables?

How do I remove a table named following a keyword in mysql?

I accidentally named a table 'order'.
Since 'order by' is a keyword phrase, I am unable to delete this table:
> drop table order;
ERROR 1064 (42000): You have an error in your SQL syntax; ...
How do I drop the table ?
Try this:
drop table `order`;
Tested and working on mysql :)
The default identifier quote character is the backtick (“`”):
drop table `order`;
Using backticks around the table name:
drop table `order`;
will work.