From the course: SQL Server Fundamentals: Master Basic Query Techniques

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Filtering on multiple conditions in SQL

Filtering on multiple conditions in SQL - SQL Tutorial

From the course: SQL Server Fundamentals: Master Basic Query Techniques

Start my 1-month free trial

Filtering on multiple conditions in SQL

- [Instructor] In analysis, it's often useful to consider more than one data point at a time, and SQL uses logical operators 'and' and 'or' on the 'where' clause to accomplish that. The basic rules of logical operators in other contexts, like mathematics, apply here in SQL as well. When you use 'and', both sides of the equation must evaluate to true to return those results. And with 'or', at least one of them must evaluate to true. Though it's fine if both conditions are met as well. So before I start our demo I'm going to show you one little trick that you can use if you're using SSMS. So if you go over here to the top right-hand corner, there is this little up and down arrow right here in the corner. And if I click that and drag it down, I can use that to freeze this top panel of my screen. So I can scroll down here, and that's going to be useful for me in this demo because this 'select' statement in the top is going to be relevant to all of our examples. So I want it here so I can…

Contents