July 2005
Intermediate to advanced
1032 pages
27h 10m
English
The previous section described how to create and drop databases. Now let's move down one level in the PostgreSQL storage hierarchy and talk about creating and dropping tables.
You've created some simple tables in the first two chapters; it's time to talk about some of the more advanced features of the CREATE TABLE command. Here is the command that you used to create the customers table:
CREATE TABLE customers (
customer_id INTEGER UNIQUE,
customer_name VARCHAR(50),
phone CHAR(8),
birth_date DATE,
balance DECIMAL(7,2)
);
This command creates a permanent table named customers. A table name must meet the naming criteria described earlier in this chapter. When you create a table, PostgreSQL automatically creates a new data type ...
Read now
Unlock full access