From the course: SQL Server 2014 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Filtering results with a WHERE clause - SQL Server Tutorial
From the course: SQL Server 2014 Essential Training
Filtering results with a WHERE clause
- Now we're going to look at filtering the results returned by a select query. Filtering those results, so that only the records that match a certain criteria are returned. Here in Management Studio, we'll start with a new query. We'll start with something pretty similar to what we worked with in the previous example. Where we're selecting four columns from HumanResources.Employee. And if we run this, we see in the lower right, the very lower right hand corner, it returned 290 rows. That is every row from the table. Now we're going to add a clause to this statement, to filter out certain rows. So being this record set is a list of employees, and how many vacation hours they have, a logical thing we might look at is how many people have more than a certain number of hours. So to do that, we'll add the keyword WHERE to the end of the SQL statement. Then we'll list the name of the column we would like to filter on, in this case, VacationHours. And then the values that we're looking for…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
What is SQL?3m 34s
-
(Locked)
Basic SELECT statement3m 35s
-
(Locked)
Filtering results with a WHERE clause3m 48s
-
(Locked)
Using wildcards in a WHERE clause2m 38s
-
(Locked)
Sorting results with ORDER BY4m 48s
-
(Locked)
INSERT statements4m 24s
-
(Locked)
UPDATE statements3m 12s
-
(Locked)
DELETE statements2m 42s
-
(Locked)
-
-
-
-
-
-
-
-
-