Christopher Tyler

Create Table with Existing Table with No Data

From Haki.

To create a table similar to an existing table in PostgreSQL, you can use the following commands:

CREATE TABLE transaction_training AS TABLE transaction WITH NO DATA;
CREATE TABLE transaction_test AS TABLE transaction WITH NO DATA;

This is a really handy syntax! We simply tell PostgreSQL to create a table similar to another table, but with no data.

<< Previous Post

|

Next Post >>

#Haki Benita #Postgresql #Sql