Hello everyone its Eddie the Magic Monkey welcome to another SQL lesson and
let's open up our Select query again so in the previous lesson we talked about
our selecting specific rows from the students table and I want you to save
this select query so then we don't have to override it so let's let's save it as
another let's copy and paste it so I can have select query two and so I have two
queries and let's close our first one and let's just edit the second query
okay so what I want to do now is I want to introduce you guys to some special
operators that we can use under the where clause so let's say that I want
all the students that are younger than the year 2000 so that's what I have here
born after the first of February let's just put 1st of January so let's run
that and these are all the people who are born after the 1st of January in
2000 and let's say I only want to list students who's a female ok so then I'm
going to go where birthday is bigger than or equal to 1st of January and then
I'm going to type in and GENDER equals right as gender capital yep
gender equals female is that what I said so if you run
this okay if you run this what happens is it'll list people who are born after
1st of January 2000 and the females so I'm just going to go back to the Select
query and include the gender column so you can see that it's it's right oops
view SQL so yep we're selecting the gender their last name first name
birthday so if you run it these people were born after first January 2000 and
their gender is female okay now the second keyword I want to introduce you
guys to is instead of and let's change it to or and the difference now is that
now it's going to list all the people who were born after first January as
well as the people who are females are not necessarily both so if you run this
query now you will have people who are born after the 1st of January and you
also have people who are females so basically you got two things if they
satisfy either of these conditions so if they are born after this year this day
or if they're females are they will all be part of the query whereas if you put
and what's going to happen is they will need to satisfy both of these conditions
for the rows to be included so now we're only going to get females who were born
after the year 2000 so that's the difference between and and or I
encourage you try that so now we've got females as well as people who are born
after the year 2000 so other than and and all
or I also want you I also want to introduce you guys to like so let's say
I want to list people whose names start with uh
start with B okay so I can go where name
sorry not name first name like so it sort of means similar similar to starting
with B and asterisks asterisks just means that it can have anything after
the character B so if you run this if you're on this it only lists Brian
because Brian starts would be obviously so that's when you would use the like
keyword so let's try starting with a J so go back to SQL like J star and let's
run it and I get John Joyce Jim Joey a lot of students okay I guess that's
enough for one tutorial we're gonna do more on this on the next lesson thanks
for watching see you next time.