In This Tutorial
How to create a database
In order to work with relational databases, the first thing to do is to create SQL database in the database server of your choice.
Whether you are working on the MS SQL server, MySQL database, Oracle etc. you need to ensure that you have the sufficient privileges to create a database or you are an admin of the database server.
The syntax to create a database from the command line is as follows:
Syntax of SQL create database
The general syntax to create a database is:
CREATE DATABASE DB_name;
Where the DB_name should be related to your project name. For this tutorial, we will use different databases, one of which will be the test_db for illustration purpose.
Example of the create database command
The following example shows how the create database command works to create a database in SQL. The following command will create a database namely test_db.
CREATE DATABASE test_db;
A database with the name of test_db is created by using the create database command. In the next chapter, we will see how to create tables in this database along with other SQL commands.
See Also – how to drop SQL database