Last Updated: 28 May, 2023
A MySQL database is an organized collection of records that are structured and are stored electronically on a computer system.
In MySQL, we can create a new database using CREATE DATABASE statement followed by the name of the database.
See the syntax and example below.
Syntax:
CREATE DATABASE database_name;
Example:
CREATE DATABASE schoolDB;
Create a database with IF NOT EXISTS option
To create a database with the "IF NOT EXISTS" option, creates a new database with the specified name if it doesn't already exist. If the database already exists, then this statement will have no effect.
Syntax:
CREATE DATABASE IF NOT EXISTS database_name;
Example:
CREATE DATABASE IF NOT EXISTS schoolDB;
That's all, guys. I hope this MySQL article is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com
MySQL Create Database
MySQL Create Database
MySQL Create Database