Exercise 43. SQL Administration

The word “administration” is overloaded in databases. It can mean “making sure a PostgreSQL server keeps running,” or it can mean “altering and migrating tables for new software deployments.” In this exercise I’m only covering how to do simple schema alterations and migrations. Managing a full database server is outside the scope of this book.

Destroying and Altering Tables

You’ve already encountered DROP TABLE as a way to get rid of a table you’ve created. I’m going to show you another way to use it and also how to add or remove columns from a table with ALTER TABLE.

ex12.sql

 1    /* Only drop table if it exists. */  2    DROP TABLE IF EXISTS person;  3  4    /* Create again to ...

Get Learn More Python 3 the Hard Way: The Next Step for New Python Programmers 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.