Creation of a database
The CREATE DATABASE statement is used to create a new SQL database.
CREATE DATABASE databaseName;
The database name must always be unique in the RDBMS.
If you want to create a new database "csteachers", the CREATE DATABASE statement will be as below.
CREATE DATABASE csteachers;
Make sure you have administrator privilege before creating a database.
Once the database is created, you can check it as follows in the list of databases.
Delete a database
The DROP DATABASE statement is used to drop an existing database from an SQL schema.
DROP DATABASE databaseName;
If you want to delete an existing database "csteachers", the DROP DATABASE statement will be as below.
DROP DATABASE csteachers;
Notes ! Be careful before using this operation, since deleting an existing database would result in the loss of the complete information stored in the database.
Make sure you have administrator privilege before deleting a database. Once a database is deleted, you can check if it still exist in the list of databases, as shown below.
Select a database
When you have several databases in your SQL schema, before starting your operation, you must select a database on which all the operations will be performed.
Use the USE statement to select an existing database in the SQL schema.
If you want to use the database csteachers, you can run the following SQL command and start using the devInfo database.