Constraining tables

From the database and its schemas, we arrive at tables. As we know, databases can hold multiple schemas, while a single schema can hold multiple tables. Tables have typed columns and items as rows. What we did not discuss before is that tables can have a lot more properties. We can consider these constraints, rules, triggers, and indexes metadata, and we can set them with expressions, or from pgAdmin. If we inspect one of our tables, we can see the definition it was created with, which is as follows:

    CREATE TABLE spatial.adm1    (     id serial NOT NULL,     geom geometry(Polygon,23700),     name_1 character varying(75),     hasc_1 character varying(15),     type_1 character varying(50),     engtype_1 character varying(50), population integer, ...

Get Practical GIS 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.