- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Fix Drop table view #1051 unknown table error in MySQL
To correctly drop a view, use the below syntax −
drop view yourViewName;
Let us first create a table −
mysql> create table DemoTable -> ( -> Id int -> ); Query OK, 0 rows affected (1.01 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(1001); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values(1002); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable values(1003); Query OK, 1 row affected (0.26 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
Output
This will produce the following output −
+------+ | Id | +------+ | 1001 | | 1002 | | 1003 | +------+ 3 rows in set (0.00 sec)
Let us first create a view −
mysql> create view view_DemoTable as select Id from DemoTable; Query OK, 0 rows affected (0.23 sec)
We will now display the records of the view −
mysql> select *from view_DemoTable;
Output
This will produce the following output −
+------+ | Id | +------+ | 1001 | | 1002 | | 1003 | +------+ 3 rows in set (0.05 sec)
Following is the query to drop view −
mysql> drop view view_DemoTable; Query OK, 0 rows affected (0.18 sec)
Now view is dropped successfully.
- Related Articles
- Fix Error in MySQL syntax while creating a table column with name “index”?
- Why the #1054 - Unknown column error occurs in MySQL and how to fix it?
- How to Drop MySQL Table using Java?
- Drop a MySQL Table after x hours?
- Fix MySQL Database Error #1064?
- Does MySQL DROP TABLE completely remove the table or just the structure?
- View the auto_increment value for a table in MySQL without using SHOW TABLE?
- How to create a table from view in MySQL?
- MySQL query error with a table named “order”?
- How can we drop UNIQUE constraint from a MySQL table?
- Resolve Unknown database in JDBC error with Java-MySQL?\n
- How to fix the incorrect datetime value while inserting in a MySQL table?
- MySQL appears to DROP USER but user still exists in MySQL.users table?
- Display an error while inserting duplicate records in a MySQL table
- How to drop table in Android sqlite?

Advertisements