This error may occur if you have used an incorrect syntax. Let’s say the following is the create table statement −
mysql> create table DemoTable1492 -> ( -> timestamp TIMESTAMP, -> event int, -> ); ERROR 1064 (42000): 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 5
You need to remove extra comma above after the event column to fix. Let us first create a −
mysql> create table DemoTable1492 -> ( -> timestamp TIMESTAMP, -> event int -> ); Query OK, 0 rows affected (0.44 sec)
Insert some records in the table using insert −
mysql> insert into DemoTable1492 values(now(),101); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1492 values(now()+interval 3 month,102); Query OK, 1 row affected (0.14 sec)
Display all records from the table using select command −
mysql> select * from DemoTable1492;
This will produce the following output −
+---------------------+-------+ | timestamp | event | +---------------------+-------+ | 2019-10-06 10:56:53 | 101 | | 2020-01-06 10:57:07 | 102 | +---------------------+-------+ 2 rows in set (0.00 sec)