Home > database >  Cannot create a table in mysql as signal
Cannot create a table in mysql as signal

Time:11-26

I cannot create the table named signal, it shows me error like below:

MySQL CREATE TABLE signal error 1064

I tried with other name it works, when the table name is signal it does not work.

I also ensured that there is no table named signal in my database.

CodePudding user response:

If you look at MySQL documentation, signal is a reserved keyword.

So, you won't be able to name your table signal.

CodePudding user response:

First it should be pointed out that SQL key words should never be used as table name or column name. This will be very unhandy, confusing and bad to read. And it can cause trouble.

So don't do that!

But the answer this is not possible is not correct.

You can create a table "signal" by using back ticks, for example:

CREATE TABLE `signal` (id int);

And just to show one issue of that: This query will fail:

SELECT id FROM signal;

You need to use back ticks again:

SELECT id FROM `signal`;

So whenever you remark that using back ticks is necessary for your table name or column name, this means you should immediately rename them.

  • Related