select * from table where column * 'value';

I accidentally wrote * for my where statement instead of =, and the query returned all rows in the table.

Made me wonder why an error wasn't thrown instead.

What does the * operator do in a where statement?


2 Answers 2



WHERE column * value

is a numeric operation of multiplication, and when the value of the expression (column * value) isn't 0, that is equivalent to TRUE so will return the row.

  • 2
    Maybe you should remark this syntax is only valid for MySQL and SQLLite.
    – McNets
    Feb 12, 2019 at 10:39
  • Starting with V11 this is also valid in Db2 (as long as the multiplication is valid) Feb 12, 2019 at 11:29
  • In MySQL, if column and/or 'value' are strings, you get a Warning " Truncated incorrect DOUBLE value:..." for each string.
    – Rick James
    Feb 12, 2019 at 19:40

Although this syntax works for MySQL 8.0 and SQLite 3.8 you will get an error on mostly all other RDBMS.

SQL Server 2017

An expression of non-boolean type specified in a context where a condition is expected, near ';'.

PostgreSQL 11

For integer columns:

ERROR: argument of WHERE must be type boolean, not type integer

For text/varchar columns

ERROR: operator does not exist: character varying * integer

Oracle 18c

ORA-00920: invalid relational operator


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.