As an example, the syntax to create Book Town's books table is demonstrated in Example 4-6 .

Example 4-6. Creating the "books" Table

booktown=# CREATE TABLE books (
booktown(#        id integer UNIQUE,
booktown(#        title text NOT NULL,
booktown(#        author_id integer,
booktown(#        subject_id integer,
booktown(#        CONSTRAINT books_pkey PRIMARY KEY (id)
booktown(# );
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 
'books_pkey' for table 'books'
CREATE

The CREATE output following the execution of the statement indicates that the table was successfully created. If you receive an error message, check your punctuation and spelling to make sure you have entered the correct syntax. Receiving no message at all means that you probably left open a quote, parenthese, or other special character symbol. Remember that in psql , you may hit the CTRL+C keys at any time to cancel a statement, and clear the buffer.

Additionally, the NOTICE statement serves to inform you that in order to properly complete the creation of this table as described, an implicit index called books_pkey will be created.