To execute SQL commands that do not return a result set (such as CREATE DATABASE), we use the
exec() method in PDO. This method executes the command and returns the number of rows affected.
When creating a database, we first connect to the server (without specifying the database name in the DSN string),
and then we execute the command. We wrap the entire process in a try...catch block to catch any access
errors.
exec() method is fast and efficient for structural SQL commands.try...catch prevents the script from crashing upon an error.