Partial selection of user-defined types

In some situations, we might only be interested in which school alice went to, but not her year of graduation. In this case, we would like to be able to perform a query that returns precisely the information we're interested in, without wasting network bandwidth on irrelevant data. Fortunately, user-defined types have this capability.

In order to do this, we simply use a dot operator to specify a single field within a user-defined type that we would like to return. For instance, to retrieve only the school_name field from the alice education field, we can perform the following query:

SELECT "username", "education"."school_name" FROM "users" WHERE "username" = 'alice';

Now, the school name is presented ...

Get Learning Apache Cassandra - 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.