title: What is wrong with my CREATE TABLE MySQL syntax?
body: <p>I am having some trouble with the <strong>CREATE IF NOT EXISTS</strong> clause.</p>
  
  <p>I am using a C# application to create a MySQL table, the connection to DB has been established so it's not a problem.</p>
  
  <p>The error I am getting is an exception when I try to execute the query, I get the message:</p>
  
  <blockquote>
    <p>MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error
    in your SQL syntax; check the manual that corresponds to your MySQL
    server version for the right syntax to use near 'IF NOT EXISTS(price
    VARCHAR, time VARCHAR)' at line 1</p>
  </blockquote>
  
  <p>In debug mode, the immediate window shows my command string as:</p>
  
  <blockquote>
    <p>CREATE TABLE ticks_14_11_2016 IF NOT EXISTS(price VARCHAR, time
    VARCHAR)</p>
  </blockquote>
  
  <p>From the examples I have seen, this should be the proper syntax. I am not worried about constraints and keys for the time being, I just need the query to execute...</p>
  
  <p>Also, here is the C# code which I use to build the string and execute query:</p>
  
  <pre><code>string tableName = "ticks_" + getTodayString();
              if (databaseClient.IsConnect()) {
                  string tableString = "CREATE TABLE " + tableName +
                  " IF NOT EXISTS" +
                  "(price VARCHAR, " +
                  "time VARCHAR)";
  
                  try
                  {
                      var command = databaseClient.Connection.CreateCommand();
                      command.CommandText = tableString;
                      command.ExecuteNonQuery();
                  } catch (Exception e)
                  {
                      Console.WriteLine(e);
                  }
              }
  </code></pre>
  
  <p>The variable <strong>databaseClient</strong> has a member that is the MySQLConnection object</p>
  
  <p>Also, my server version is: <strong>5.6.28-76.1</strong></p>