English subtitles

← Select Where - Intro to Relational Databases

Get Embed Code
4 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. So we wanted to find all of
    the animals that are not gorillas and
  2. also not named Max.
  3. So we could do it this way.
  4. Select name from animals where
    not species equals gorilla,
  5. and not name equals Max.
  6. Or here's another way we can do it.
  7. There's a logic rule
    called Demorgans law,
  8. that lets us switch not X and
    not Y into not X or Y.
  9. So we can say select name
    from animals where not
  10. parenthesis species equals gorilla or
    name equals max.
  11. That will do the same thing.
  12. Or hey, here's a third way.
  13. SQL supports the not equals or bang
    equals operator, just like python does.
  14. So we can say, select name from animals,
  15. where species not equals gorilla,
    and name not equals Max.
  16. Any one of those three
    will work just fine.
  17. They'll all produce the same results.