Creating a new database
The creation of an actual database is the first thing we are asked to do. Creating the database is, in itself, very simple in its most basic form. It can be done with a single line of code. The database in Workbench can be created using the following command:
CREATE SCHEMA '<database name>';
In addition, you can use the same syntax in the command line for MySQL to create a database.
Note
Some SQL statements have synonyms, which contain different syntax but have the same functionality. To create a database, you can use CREATE SCHEMA '<database name>';
or CREATE DATABASE '<database name>';
. Both will create a database in the same way.
In the following exercises, we will create two new databases, just to go through the process. We will not use them any further, and all other work in the chapter will be with the autoclub
database.
Exercise 3.03 – creating a new database
Your company is...