Summary of Search Conditions

Before we start sorting data, let's review what you've learned so far about search conditions:

  • To improve overall system performance, do all your data filtering on the server. That will reduce network traffic (from transferring unnecessary rows) and simplify application programming.

  • Search conditions appear in a WHERE clause. The WHERE clause must follow the table list. If no WHERE condition is specified, your query operates on the entire table.

  • You can use equality, inequality, and range comparisons to test values of any data type. Range searches with datetime values should avoid using BETWEEN.

  • You will need to combine search conditions with OR and AND. When you combine more than two conditions, especially when OR is ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.