简体   繁体   中英

DROP TABLE in MySQL

I have created a MySQL table with the following code from a tutorial, I just put it into the MySQL console:

CREATE  TABLE `test`.`name` (
  `nameid` INT NOT NULL AUTO_INCREMENT ,
  `firstname` VARCHAR(45) NULL ,
  `lastname` VARCHAR(45) NULL ,
  PRIMARY KEY (`nameid`)
);

INSERT INTO `test`.`name`
(`firstname`,`lastname`)
VALUES
("TheBig","Monster"),
("Guy","Smiley"),
("Big","Bird"),
("Oscar","Grouch"),
("Alastair","Cookie");

With the python script given in the tutorial I am able to print each item.

But when it comes to erase the table, I have tried all possible combinations of:

DROP TABLE `test`
DROP TABLE test
DROP TABLE `test`.`name`

etc, but none will erase it. Moreover, If I use the initial table creation script again, it will add the entries to the table, so I know its a stored table within MySQL but cannot access it, delete it, or list it with: SHOW DATABASES or SHOW TABLES

It is my first afternoon with MySQL, but don't know how to go further if the commands in the MySQL help are not working!

So the summary question is: How to delete / access the table created with the script?

drop table test.name;

这应该工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM