query

SQL NOT EQUAL



Sharing buttons:

let's do a not equal and if I just do

select star from customers here's all my

stuff let's see I want everybody who's

not from Washington right so I'm gonna

do select star from customers where see

state is not equal to Washington

anything wrong with that I look good

how many people say that looks good

doesn't what maybe I'm forgetting

something I mean people say that looks

good how many people say it doesn't look

good

how many people are like I have no idea

man

parentheses parentheses around see state

like this I could also do it like this

way see if I could do it this way this

is common not equal to in programming

yep that also worked right both of them

gave me the same result

let's just move this down so you can see

that there's this one not equal and then

there's this one not equal so now we've

got California or Oregon how would I get

just California without using equals

California I could do maybe and if I do

and what's it have to be both true so

what that makes sense where see states

not equal to Washington and see state is

not equal to Oregon so it would when

it's when it's California the first one

would be true

see States not equal to Washington and

so let's just put that in let me make

this a little wider

and okay I don't know what just happened

I'm gonna enter that who knows what that

was and see state is not equal all right

I could do it either way to Oregon now

let's look at let's look at that logic

so I'm gonna copy this I want to see my

stuff before I enter this let's see my

records come on

oh you're almost there it's like I get a

little radio interference from the keel

all right next to my USB mouse oh good

copy it and I'm just gonna do a select

star from customers so they're all my

records and I have this one so when sea

state is if is California sea States

California sea State not equal to

Washington that's true California is not

equal to Washington true California is

not equal to Oregon that's also true

where true and true good give me the

results right true and true is true true

and false it's false so that should just

give me California which would be the

same as doing it like this

I want to do double equals because

that's assignment and programming but we

do double equals

it really equals California nope can't

do double equals so that's the not equal

to let's go back to this select all of

them just to see you and then go to this

what about if we add or what results are

we going to get from that so we want to

select star from customers where state

is not equal to Washington or state is

not equal to Oregon

all right so let's evaluate whence

California California is not equal to

Washington that's true or California is

not equal to Oregon that's true right

Washington Washington is not equal

that's false or Washington's naik that's

true so with or it's one or the other so

false true also get Washington because

Washington is not equal to organ that's

true and when it came to Oregon

Oregon's not equal to Washington that's

true so I'll get all of them again I got

all eleven again cuz it's always one of

them one of the work conditions is

always true so that's the not equal and

your and in your or