Listing 1. Creating a Table
CREATE TABLE AddressBook (
person_id SERIAL,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
address1 TEXT NOT NULL,
address2 TEXT NULL -- Not everyone needs
a 2nd line
city TEXT NOT NULL,
state_province TEXT NULL, -- Not everyone lives
in the US
postal_code TEXT NULL, -- Not all countries
have them
phone_number TEXT NOT NULL, -- Not everyone
lives in the US
fax_number TEXT NULL, -- Not everyone has
a fax
cell_number TEXT NULL, -- Not everyone has
a cell phone
PRIMARY KEY(person_id)
);
Copyright © 1994 - 2019 Linux Journal. All rights reserved.