6

Selection Criteria

Keywords Introduced

WHERE • TOP • PERCENT • LIKE • SOUNDEX • DIFFERENCE

Up until this point, the SELECT statements we’ve seen have always brought back every row in the table. This would rarely occur in real-world situations. We are normally interested only in retrieving data that meets certain criteria. For example, if you’re selecting orders, you probably only want to see orders that meet certain conditions. When looking at products, you ordinarily only want to view certain types of products. Rarely does someone want to simply see everything. Your interest in data is typically directed toward a small subset of that data in order to analyze or view one aspect.

Applying Selection Criteria

Selection criteria in SQL begins ...

Get The Language of SQL, 3rd 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.