It is best practice to wrap commands in a transaction. [Transactions](https://www.postgresql.org/docs/current/tutorial-transactions.html) will preserve database integrity by rolling back all commands executed if one fails. To create a transaction, simply begin and end the series of commands with `BEGIN` and `COMMIT`.
```SQL
BEGIN;
-- SQL Commands
COMMIT;
```