mysql> create table forDeletes(id int primary key, a int); Query OK, 0 rows affected (0.02 sec) mysql> insert into forDeletes VALUES(1,1),(2,2),(3,3),(4,4),(6,9),(100, 9); Query OK, 6 rows affected (0.00 sec) Records: 6 Duplicates: 0 Warnings: 0 mysql> select * from forDeletes; +-----+------+ | id | a | +-----+------+ | 1 | 1 | | 2 | 2 | | 3 | 3 | | 4 | 4 | | 6 | 9 | | 100 | 9 | +-----+------+ 6 rows in set (0.00 sec) mysql> delete from forDeletes -> where id = 2; Query OK, 1 row affected (0.00 sec) mysql> where id = 2; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where id = 2' at line 1 mysql> select * from forDeletes; +-----+------+ | id | a | +-----+------+ | 1 | 1 | | 3 | 3 | | 4 | 4 | | 6 | 9 | | 100 | 9 | +-----+------+ 5 rows in set (0.01 sec) mysql> delete from forDeletes -> where Id < 3 OR Id > 50; Query OK, 2 rows affected (0.00 sec) mysql> select * from forDeletes; +----+------+ | id | a | +----+------+ | 3 | 3 | | 4 | 4 | | 6 | 9 | +----+------+ 3 rows in set (0.00 sec) mysql> delete from forDeletes where Id < a; Query OK, 1 row affected (0.00 sec) mysql> select * from forDeletes; +----+------+ | id | a | +----+------+ | 3 | 3 | | 4 | 4 | +----+------+ 2 rows in set (0.00 sec) mysql> exit