Mega Code Archive

 
Categories / PostgreSQL / Insert Delete Update
 

List the columns explicitly

postgres=# CREATE TABLE products ( postgres(#    product_no integer, postgres(#    name text, postgres(#    price numeric postgres(# ); CREATE TABLE postgres=# -- List the columns explicitly postgres=# postgres=# INSERT INTO products (product_no, name, price) VALUES (1, 'Cheese', 9.99); INSERT 0 1 postgres=# INSERT INTO products (name, price, product_no) VALUES ('Cheese', 9.99, 1); INSERT 0 1 postgres=# postgres=# postgres=# select * from products;  product_no |  name  | price ------------+--------+-------           1 | Cheese |  9.99           1 | Cheese |  9.99 (2 rows) postgres=# postgres=# drop table products; DROP TABLE postgres=# postgres=# postgres=#