What does '' = '' mean
''=''
always true
as it compares two empty strings
So essentially ''=''
is Tautology
, and in addition, you are using a condition OR
, and thus your entire condition is always true
. Yours WHERE
can also be written as
where Name = 'John' or 1 = 1
Your request can only be select * from Employees
because the condition WHERE
has no effect.
source to share
This is a rather pointless suggestion where
when looking up a name with
where Name = 'John'
But it also searches with an expression that always returns true:
or '' = ''
This way, all data will be returned independently.
There should be no reason to include the second part unless the clause where
is generated on the fly somewhere and the name filter is optional. If you include the always true part, it will prevent an error if the names are not filtered. I would also question its use, as it will return additional data.
If this is a generated sentence where
and it is needed, it might make more sense:
or 1=2
Then you won't be returning any additional data.
source to share