2

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.

Aditya Kaushik
  • 213
  • 1
  • 4
  • 20

1 Answers1

1

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.

Bud Damyanov
  • 30,171
  • 6
  • 44
  • 52
  • ... for not having to check whether to add an `AND` before first condition or not :) – A4L Mar 19 '13 at 10:03
  • @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. – Aditya Kaushik Mar 19 '13 at 10:21