In a lot of SQL examples , while copying one table's structure without the data , we see the use of AND 1 = 1 clause. What exactly is this 1=1 and is there any other thing similar to it in SQL or any other DBMS.
1 Answer
It is a SQL language construct, which evaluates always to true (because 1 is always equal to 1). It is used mostly when generating dynamic SQL queries for developer`s convenience.
2 Comments
A4L
... for not having to check whether to add an
AND before first condition or not :)Aditya Kaushik
@A4L Thanks for your answer. I also found some new facts in the questions suggested above. So I request you to vote to delete this question.