O'Reilly logo

Learn More Python 3 the Hard Way: The Next Step for New Python Programmers by Zed A. Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required