fluidthoughts developers' guild

fluid funk

howto / pgsql-table-basics

postgres table basics

Create a table:

test=# create table friend (
test(#  firstname CHAR(15),
test(#  lastname CHAR(20),
test(#  age INTEGER  
test(# );

Describe a table:

\d friend
			Table "friend"
 Attribute |     Type      | Modifier 
-----------+---------------+----------
 firstname | character(15) | 
 lastname  | character(20) | 
 age       | integer       | 

Inserting data

test=# INSERT INTO friend VALUES('Bruce', 'Lee', 32);

Selecting data

test=# SELECT * FROM friend;
	firstname    |       lastname       | age 
-----------------+----------------------+-----
 Jackie          | Chan                 |  47
 Jet             | Li                   |  38
 Chuck           | Norris               |  61
 Bruce           | Lee                  |  32
(3 rows)

Deleting select data

test=# DELETE FROM friend WHERE lastname='Norris';

 

$Id: pgsql-table-basics.html,v 1.2 2002/08/15 04:51:44 willn Exp $