Query Predicates in SQL Server

Sometimes people speak “SQL” and expect you know all the terminology. In recent a conversation about query plans I was ranting on and on about how the predicates were written when the person stopped me and asked a very simple question. Like a light bulb going off, it reminded me that not everyone knows what the other person is talking about when terminology is mentioned without clarification.

So, this post will answer that persons very valid simple question.

What is a SQL Predicate?

Predicates are expressions that evaluate to TRUE, FALSE, UNKNOWN. There are two types of predicates Filtered Predicates and Join Predicates.

Filtered Predicates cover your WHERE or HAVING clauses in your query. They are essentially search criteria.

JOIN Predicates cover your FROM clauses in your query. They are essentially merge criteria so to speak. They bring two or more tables together based on the join similarity criteria.

So, there it is. Just a simple blog to answer a great question. Don’t ever be afraid to stop someone and ask a question, no matter how simple the question may be. Knowing the terminology is important. I stop and ask people to clarify terminology all the time during their presentations or a conversation between my co-workers.

 

 

About Monica Rathbun

Monica Rathbun lives in Virginia, is a Microsoft MVP for Data Platform and Microsoft Certified Solutions Expert. She has nearly two decades of experience working with a wide variety of database platforms with a focus on SQL Server and the Microsoft Data Platform. She is a frequent speaker at IT industry conferences on topics including performance tuning and configuration management. She is the Leader of the Hampton Roads SQL Server User Group. She is passionate about SQL Server and the SQL Server community, doing anything she can to give back. Monica can always be found on Twitter (@sqlespresso) handing out helpful tips. You can find Monica blogging at sqlespresso.com 
Bookmark the permalink.

Comments are closed.