title: Create table table if not exists else alter table
body: <p>I have a MySQL Database with a Table (Mail) which has the columns : ID, Content, Date and Title. I would like to know if there is an option to check if the table exists and if it does then alter the table for example if I want to add a column. The only possible solution I found for this was something like this:</p>
  
  <pre><code>$sql=mysql_query(
          "SELECT something FROM Mail");
  
  if (!$sql){
  
  mysql_query("ALTER TABLE Mail ADD Test VARCHAR(150) DEFAULT NULL");
  
  }ELSE{
  
  mysql_query("CREATE TABLE if not exists `Mail` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Content` longtext,
  `Datum` varchar(15) DEFAULT NULL,
  `Titel` varchar(150) DEFAULT NULL,
  `Test` varchar(150) DEFAULT NULL,
  
  PRIMARY KEY (`ID`)
  ) ");
  
  }
  </code></pre>
  
  <p>So I would like to know if there is a simpler way to do this and maybe even in 1 query(probably not)? If anyone knows a better/simpler way to do this it would be great!</p>
  
  <p>And I know Mysql_ is deprecated but I will switch to PDO soon!</p>