Single Equals in MYSQL

conditional-statements, equals, mysql, sql

Solution

Hi, I was wondering why MYSQL uses a single equals sign in conditional statements instead of the more typical two equals signs. Is there a technical/historical reason for this? Thanks.

Comparison is much more common in `SQL` than assignment.

That's why `SQL` uses more short syntax to do more common things.

In classical `SQL`, comparison can be distinguished from assignment by context (assignment can be only in `SET` clause of an `UPDATE` statement), that's why one operator can be used for both operations.

In `MySQL`'s extension to `SQL`, assignment to a session variable is denoted by `:=`

Problem

I was wondering why MYSQL uses a single equals sign in conditional statements instead of the more typical two equals signs. Is there a technical/historical reason for this? Thanks.

Original source