O'Reilly logo

Sams Teach Yourself Core Data for Mac® and iOS in 24 Hours by Jesse Feiler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hour 10. Working with Predicates and Sorting

What You’ll Learn in This Hour:

Selecting data the Core Data way

Constructing predicates

Sorting data two ways

Understanding Predicates

A predicate is a logical operator that evaluates to a Boolean value—true or false. Many people think of a predicate as the WHERE clause in a SQL statement, but that is only one particular case. In SQL, you can write the following:

SELECT name, address FROM employee WHERE department = 'research';

department = 'research' serves as the predicate. For each record that might be returned by the SELECT statement, department = 'research' is evaluated based on that record’s data and the result is either true or false. The records where the result is TRUE are returned ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required