When creating new projects and new databases, we can use the template0 database instead of writing one by one.
Example:
1 | CREATE DATABASE proje1 TEMPLATE template0; |
If you want to do this through pgadmin, you can select the database in the template tab in the definition section.
You can use TEMPLATE to create a copy of a different database, but to do this, there must be no session on the database you want to copy.
1 | CREATE DATABASE new_database TEMPLATE copy_desired_database_name ; |
Example:
1 | CREATE DATABASE customers_new TEMPLATE customers ; |
In the example above we are creating a copy of the customers table in the format customers_new.