1

I have an assignment that wants me to find schools in an area that have an enrollment greater than 500. I've input this: "zipcode" = '10002' OR "zipcode" = '10003' AND "enrolled" > 500. But with this, instead of results being over 500, I also get results less than 500. I've also tried AND NO < 499 and that hasn't worked as well.

1 Answers1

3

You immediate problem is that you need parentheses. However, you should learn to use IN, because that also fixes the problem:

where "zipcode" in ('10002', '10003') and "enrolled" > 500

Without parentheses, your version is interpreted as:

where "zipcode" = '10002' or
      ("zipcode" =  '10003' and "enrolled" > 500)

The condition on enrolled only applies to zip code 10003.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786