Adding New Records to a Table
The two previous sections showed you how to create some simple tables and how to view the table definitions. Now let's see how to insert data into these tables.
Using the INSERT Command
The most common method to get data into a table is by using the INSERT command. Like most SQL commands, there are a number of different formats for the INSERT command. Let's look at the simplest form first:
INSERT INTO table VALUES ( expression [,...] );
A Quick Introduction to Syntax DiagramsIn many books that describe a computer language (such as SQL), you will see syntax diagrams. A syntax diagram is a precise way to describe the syntax for a command. Here is an example of a simple syntax diagram: INSERT INTO table VALUES ... |
Get PostgreSQL, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.