Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5948509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:07:03+00:00 2026-05-22T17:07:03+00:00

In simply sql book, there is portion of code mentioning if I use where

  • 0

In simply sql book, there is portion of code mentioning if I use where 1 = 0, i can safely add an OR conditions like:

WHERE
   1=0
   OR name LIKE '%Toledo%'
   OR billaddr LIKE '%Toledo%'
   OR shipaddr LIKE '%Toledo%'

I didnt get it why when i use where 1 = 0 i can safely add an OR statement

Can i just use something like below?

WHERE
   1=1
   OR name LIKE '%Toledo%'
   OR billaddr LIKE '%Toledo%'
   OR shipaddr LIKE '%Toledo%'

I understand that where 1=1 is a shortcut to add an And statement.
I understand that because where 1 =1 will return true.Can i use it for Or statement too?
Istill didnt get the part where 1 = 0
Any explaination would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:07:04+00:00Added an answer on May 22, 2026 at 5:07 pm

    This depends on the type of boolean operations you’re working on. If you want to add a variable number of AND statements, then you use a statement that invariably evaluates to true, such as 1 = 1. On the other hand, if you want to do the same with OR statements, then you should use a statement that evaluates to false, such as 1 = 0.

    Let’s say you have a boolean variable x with an indeterminate truth value (it might be true, or it might be false. You don’t know.) Now, if you find the value of x AND false, you get false, regardless of what the value of x is.

    On the other hand, if you look at x OR true, you’ll get true. Again, this is regardless of the truth value of x.

    In your statement, you want the hard-coded value to have no effect on the logic of the query. Since false OR a OR b OR c is logically equivalent to a OR b OR c, the hard-coded statement has no effect. In the other case, true AND a AND b AND c is equivalent to a AND b AND c.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simple Add-On for SQL Server 2008; it is simply
Why would I want to use Oracle Designer as opposed to simply maintaining SQL
I have several sql queries that I simply want to fire at the database.
The following PL/SQL will not execute and simply returns 'Invalid Argument' as an error.
I have a simple SQL 'Select' query, and I'd like to dump the results
Some while ago, I've been reading through the book SQL and Relational Theory by
I'm preparing to the SQL Server exam (70-431). I have the book from Sybex
I am simply trying to call a store procedure (SQL Server 2008) using C#
Is there any way populate an Access Form's text feild's value using SQL? I
Can anybody help me for a deadlock in SQL Server 2005? For a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.