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 ...

Get Sams Teach Yourself Core Data for Mac® and iOS in 24 Hours 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.