Value before variable
comparison, sql, variable-assignment
Solution
Er, C++ is not SQL. There's no `==` in SQL and no assignments in a `WHERE` clause.
I'm not sure it qualifies as "best practice" but there is a convention which places the known value on the right-hand side. So, with a literal as in your example that would be
WHERE CCY = 'USD'
Problem
I'm looking at some SQL code which has a WHERE clause like this: ``` WHERE 'USD' = CCY ``` I asked the writer why he's putting the value on the left hand side, and he said it's best practice to do so, stemming from C++ where people could mistakenly assign the value instead of comparing equality by forgetting the second equals sign. I've never seen this before. What are your thoughts?