Mega Code Archive

 
Categories / PostgreSQL / Insert Delete Update
 

Request default values explicitly, for individual columns

postgres=# postgres=# postgres=# CREATE TABLE products ( postgres(#    product_no integer, postgres(#    name text, postgres(#    price numeric postgres(# ); CREATE TABLE postgres=# -- Request default values explicitly, for individual columns postgres=# INSERT INTO products (product_no, name, price) VALUES (1, 'Cheese', DEFAULT); INSERT 0 1 postgres=# postgres=# postgres=# select * from products;  product_no |  name  | price ------------+--------+-------           1 | Cheese | (1 row) postgres=# postgres=# drop table products; DROP TABLE postgres=# postgres=# postgres=#