Search code examples
mysqlsqlmysql-workbenchrdbms

sql syntax error with VERY basic command? why?


I am trying just create a table using MySql Workbench. Here's the sql command:

CREATE TABLE `bmxData`.`new_table` ();

yet I get this error while executing this :-

Executing:

CREATE TABLE bmxData.new_table ();

Operation failed: There was an error while applying the SQL script to the database.

ERROR 1064: 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 ')' at line 1

SQL Statement:

CREATE TABLE bmxData.new_table ()

Any idea why? I have no idea what I'm doing wrong...


Solution

  • You need to add at least one column:

    CREATE TABLE `bmxData`.`new_table`(col INT);
    

    Some RDBMS allow to define table without explicit user column like PostgreSQL:

    CREATE TABLE tab();
    

    DBFiddle Demo