A crash course in PostgreSQL, part 2

15.09.2011

We only created the table structure, so let's populate it with data. Tables have columns and rows. Each column contains a specific data type, and each row contains your data. Don't get bogged down in row order because it doesn't matter, and you can't control it anyway. It may help to think of a database as a collection of reasonably-organized pots of data, into which you dip precise queries to retrieve whatever data you want. It's the queries that need to be specific and well-ordered, not your table rows. The INSERT statement put data into our table rows, like this:

testdb=# INSERT INTO comics VALUES ('Fabulous Furry Freak Brothers 1',

'Rip Off Press', '1971-03-15');

INSERT 0 1

You must insert your data in the correct column order. If you don't remember your column order, there are two options: one, read your table structure: