Mysql Create Table (non-existing)
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
Mysql Create Table (non-existing)
I have a page that creates a table in a database. How can I make this code so if the table doesn't exist create it. Do I just do a select table before and if it returns something don't create the table?
http://dev.mysql.com/doc/refman/5.0/en/ ... table.html:
Code: Select all
CREATE TABLE IF NOT EXISTS tbl_nameMysql has an extension to the CREATE TABLE syntax
But why not simply trying to create the table. If it already exists you get a specific error signaled.
but that's mysql specific.http://dev.mysql.com/doc/refman/5.0/en/create-table.html wrote:CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
But why not simply trying to create the table. If it already exists you get a specific error signaled.
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida