Goal: Create an empty database, inspect its copied schema, then recreate it using SQL from a different database.
At the shell, create inventory_db with createdb. -U postgres explicitly selects the administrative SQL role because student lacks CREATEDB; it does not switch your Linux account. --encoding=UTF8 selects text encoding; --template=template0 copies the pristine template. Success prints nothing. The next step verifies the database instead of treating silence alone as proof.
From the shell, connect with psql -U postgres -d postgres, then run \l. Check that inventory_db appears with owner postgres, the role used by createdb. Plain psql uses the default SQL role student, which cannot drop this database or create databases. If you already opened psql that way, run \c postgres postgres to select both the maintenance database and the SQL role postgres.
Inside psql, run \c inventory_db to switch databases while keeping the SQL role selected in the previous step (postgres). The connection message should say database inventory_db and user postgres. Run \conninfo whenever you want to check both.
Run \dn inside inventory_db. Expect public owned by pg_database_owner: the schema came from the copied template. You have created a database, not any application tables.
Inside psql, run \c postgres postgres before dropping the database. The syntax is \c DATABASE ROLE: the first postgres is the maintenance database; the second is the administrative SQL role.
You must leave inventory_db before dropping it, and run the command as its owner or a superuser. It was created by postgres, so student cannot drop it. \c postgres alone keeps your current role: if you entered with plain psql, you remain student and get ERROR: must be owner of database inventory_db.
Run \conninfo and confirm database postgres, user postgres. Then run DROP DATABASE inventory_db; followed by CREATE DATABASE inventory_db ENCODING 'UTF8' TEMPLATE template0;. Each successful SQL command prints its command name. If the earlier DROP failed, the database still exists; switch roles and retry without resetting the lab.