April 2017
Beginner to intermediate
360 pages
9h 35m
English
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 ...
Read now
Unlock full access