From the course: Database Foundations: Intro to Databases

Unlock the full course today

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

Filter rows with WHERE

Filter rows with WHERE

From the course: Database Foundations: Intro to Databases

Start my 1-month free trial

Filter rows with WHERE

- [Instructor] When you want to start filtering the rows of data that are returned in a select query, you'll add a where clause. The where clause allows you to specify the criteria that rows must meet in order to be included in the results set. Once again, we're going to query data out of the products table in the TwoTrees database. So I'll right-click on it and choose new query. Let's start by selecting everything from the products table. We do that with select star from products.products. When I run this query and then take a look down in the status bar, you'll see I have a total of 114 results returned in this result set. Now let's suppose that I was only interested in viewing the products that were in category number two. We can do that by coming up here and right before the semi-colon, I'll just move that down to line number three, I'll add in my where clause anywhere I can say where category ID is equal to two.…

Contents