Hey guys welcome to another SQL tutorial last lesson we learned about and or and
like so I want to save these queries and close them and create another copy of it
so create another copy and call it select query 3 so yeah basically I just
want to make sure that I don't delete all of these queries cuz it's not easy
to make them up from scratch so the last query that we did was we selected all
the students whose first name start with J and now I'm going to talk about the
between keyword or a special operator so rather than just like J so their first
name starts with J I'm also gonna use the end keyword which means that they
have to satisfy both conditions and then I'm going to go and their birth date so
yeah birth dates is in between so between so what do we have
let's just put between the 1st of January 2000 and 1st of February 2000 sorry
first of January 2001 so I'm getting students names that start
with J and they have to be born in this year so
let's try that and there was only one person all right John who was born in
2000 January 7th so let's expand our search a little bit so go back to SQL
and let's make it 1999 to 2002 see if we get a few more students so yep we got a
few more students who were born between that time so yeah that's basically the
so what have we done we've done between and I'm also going to introduce you to
the not special operator so all of these conditions if I put the keyword not in
front of any of them then it reverses the condition so instead of students
whose names start with J I'm gonna get rid of this for that for now because it
might confuse you instead of getting students whose name
start with J this will list all the students whose names do not start with J
so if you run that these are all the students whose names don't start with J
okay so you can also do you can also combine this with everything else we've
learned so let's do and gender is not
female actually I'm just gonna put not in front of that so not gender equals
female and if you run that then it's gonna list students whose names don't
start with J and then not female so only these two guys
don't do that right let's go back to SQL view let's get rid of that so these are
all the students whose names don't start with J and there's only two of them are
males so yeah it was right so yeah let's put that there so only two people who
satisfy both conditions so yeah today we've learnt a few more things we
learned in between and we learn not and let's give you guys one more thing
actually I'm just gonna give you two more things so I'm gonna put these two
conditions within brackets so I can have both of these conditions together and
then I'm gonna use the OR keyword and then I'm gonna have another condition so
what's gonna happen is it's these two conditions or some other conditions and
basically if they satisfy either of these either this condition as a whole so these
two conditions acting as one or another condition if they satisfy either one of
them they will be listed so that is the first concept and second concept I'm
gonna give you is in or their first name is in and then I can put a list of
options so what first names that I have there's Phoebe Sarah Brian so I'm gonna
put in Phoebe
Sarah and Brian okay so let's run it first to see that it's working so yeah
it does work so you can see if their name starts with if their names are
Phoebe Sarah and Brian they're be listed the other way they're going to
be listed is if they have a first name that does not start with J and their
gender is male so that's basically just Daniel okay so yeah
that's basically everything that I wanted to show you hopefully this has
helped you a little bit thanks for watching see you next time.