Sunday 24 February 2019

Tricky Interview Question: What will the output of the where 1=1 or WHERE ''=''

Where clause in SQL server is used to filter the records based on some condition. Records will return based on the true condition. Suppose we want to return all records from the table using where clause we need to write the where condition which is always true.  
With the help of the below condition, we will achieve this.
Where 1=1 or where ‘’=’’
Let’s see this example.
Without where clause number of records in the table.

Note: I am using AdventureWorks2012 database
 With where 1=1
                          
Now with where ‘’=’’


No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts