Solutions to fix the 'psql' is not recognized error on Windows by adding PostgreSQL to PATH or reinstalling PostgreSQL with psql.
CREATE DATABASE ... WITH TEMPLATE (Easiest)This is the fastest and recommended way.
CREATE DATABASE new_db_name
WITH TEMPLATE old_db_name
OWNER your_user;
CREATE DATABASE school_copy
WITH TEMPLATE school
OWNER postgres;
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'school';