2012-02-02 117 views
0

我使用coomand,create table person (id int, name int)在MySql中创建表格。实际上,如果数据库中不存在人员表,我想创建表人员。任何人都可以帮助我,怎么做到这一点?在MySql中创建表格问题

+0

这可能帮助:http://stackoverflow.com/questions/84330/mysql-create-table-if-not-exists-else-truncate – Dan 2012-02-02 22:23:47

+0

还是这个:http://stackoverflow.com /问题/ 9069179/IF-表不 - 不存在 - 执行 - 一个长的查询/ 9069391#9069391 – thursdaysgeek 2012-02-02 22:40:33

回答

4

CREATE TABLE IF NOT EXISTS person (id INT, name INT)怎么样?

2

The manual page说,你应该使用

CREATE TABLE IF NOT EXISTS person (id int, name int); 
2
CREATE TABLE IF NOT EXISTS person (id int, ...); 

manual