Let's continue toward the goal of making a table exactly
like the friends table in table . We have the table
created, but there is no data (friends) in it. You add data into a table with
the INSERT command. CREATE TABLE had a specific format
that had to be followed. INSERT has a specific format too. You can
see the format in figure .
First, you have to use single quotes. Double quotes will not work. Spacing
and capitalization are optional, except inside the single quotes. Inside them,
the text is taken as literal, so any capitalization will be stored in the database
exactly as you specify. If you type too many quotes, you can get to a point
where your backslash commands don't work anymore, and your prompt will appear
as test'>. Notice the single-quote before the greater-than sign. Just
type another single quote to get out of this mode, use \r
to clear the query buffer and start again. Notice that the 19 doesn't
have quotes. It doesn't need them because the column is a numeric column, not
a character column. When you do your inserts, be sure to match each piece of
data to the receiving column. Use the INSERT query in figure
as a sample and complete the insertion the three friends shown in table .
POSTGRESQL supports more column types than just char() and integer.
It supports a wide variety of column types, but for this chapter, we will use
only these two. Section and chapter
cover column types in more detail.