7.9. Modifying Objects

After objects like tables have been created, it might be necessary to modify those objects. Therefore PostgreSQL provides some simple commands, which you will learn about in this section.

7.9.1. Modifying Tables

Most modifications can be done with the command UPDATE and ALTER. You have already learned about UPDATE in this chapter, and now it is time to have a closer look at the ALTER command. Many activities, such as modifying users, groups, and tables, can be done with ALTER. In this section you will focus on ALTER TABLE. Let's look at the syntax overview of the command:

phpbook=# \h ALTER TABLE Command: ALTER TABLE Description: change the definition of a table Syntax: ALTER TABLE [ ONLY ] table [ * ] ADD [ COLUMN ] column ...

Get PHP and PostgreSQL: Advanced Web Programming 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.