'IF NOT EXISTS' parameter can be used to check if a table exists before you actually create it : Create Table : Table MySQL TUTORIALS


MySQL TUTORIALS » Table » Create Table »

 

'IF NOT EXISTS' parameter can be used to check if a table exists before you actually create it


CREATE TABLE IF NOT EXISTS tablename (columnname data type);

mysql>
mysql>
mysql> CREATE TABLE IF NOT EXISTS employee (id int);
Query OK, rows affected (0.03 sec)

mysql>
mysql> desc employee;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11| YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
row in set (0.01 sec)

mysql>
mysql> drop table employee;
Query OK, rows affected (0.02 sec)

mysql>
mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Table
» Create Table