Let's continue toward the goal of making a
table exactly like the friend table shown in Table .
So far, we have created the table, but it does not contain any friends.
You add rows into a table with the INSERT statement.
Just as CREATE TABLE has a specific format that must be followed,
INSERT also has a specific format. Figure
shows this format.
test=> INSERT INTO friend VALUES (
test(> 'Mike',
test(> 'Nichols',
test(> 'Tampa',
test(> 'FL',
test(> 19
test(> );
INSERT 19053 1
You must use single quotes around the character strings. Double quotes
will not work. Spacing and capitalization are optional, except inside
the single quotes. Inside them, the text is taken literally, so any
capitalization will be stored in the database exactly as you specify.
If you type too many quotes, you might reach
a point where your backslash commands do not work anymore, and your
prompt will appear as test'>. Notice the single quote
before the greater than symbol. 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 does not have quotes. It does not need them because the
column is a numeric column, not a character column. When you do your
INSERT operations, be sure to match each piece of data to
the receiving column. Figure shows
the additional INSERT commands needed to make the friend
table match the three friends shown in Table
.
test=> INSERT INTO friend VALUES (
test(> 'Cindy',
test(> 'Anderson',
test(> 'Denver',
test(> 'CO',
test(> 23
test(> );
INSERT 19054 1
test=> INSERT INTO friend VALUES (
test(> 'Sam',
test(> 'Jackson',
test(> 'Allentown',
test(> 'PA',
test(> 22
test(> );
INSERT 19055 1