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.

0

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

... for not having to check whether to add an AND before first condition or not :)
@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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.