Postgres Commands


CREATE

We can see our new table by typing this:

List of relations

Schema | Name | Type | Owner

——–+————+——-+———-

public | playground | table | postgres

(1 row)

INSERT

 

  • Message returned if only one row was inserted. oid is the numeric OID of the inserted row.

Ex: INSERT oid 1

  • Message returned if more than one rows were inserted. # is the number of rows inserted.

Ex: INSERT 0 #

SYNTAX:

INSERT INTO TABLE_NAME (Column1,column2,…columnN) VALUES (value1,value2,….valueN);

SELECT

output will be look like

equip_id | type | color | location | install_date

———-+——-+——–+———–+————–

1 | slide | blue | south | 2014-04-28

2 | swing | yellow | northwest | 2010-08-16

(2 rows)

DELETE

ALTER

UPDATE

LIKE CLAUSE

LIMIT CLAUSE

From the above command psql will fetch the total as 4 rows and starting with 2nd row.

LIMIT=no of rows to be returned.

OFFSET= starting of the row number.

ORDER BY

GROUP BY