A database is a logically organized collection of structured data kept electronically in a computer system. A database management system is usually in charge of a database (DBMS). The data, the DBMS, and the applications that go with them are referred to as a database system, which is commonly abbreviated to just database.
To make processing and data querying efficient, data in the most common types of databases in use today is often described in rows and columns in a sequence of tables. Data may then be accessed, managed, updated, regulated, and organized with easily. For writing and querying data, most databases employ structured query language (SQL).
SQL is a computer programming language that nearly all relational databases use to query, manipulate, and define data as well as manage access. SQL was first developed in the 1970s at IBM with Oracle as a key contribution, leading to the creation of the SQL ANSI standard. Since then, SQL has developed a slew of extensions from businesses including IBM, Oracle, and Microsoft. Despite the fact that SQL is still commonly used today, other programming languages are emerging.
The CREATE DATABASE statement is used to create a new SQL database. In SQL, the 'Create Database' statement is a first step for storing the structured data in the database.
This SQL statement is used by database developers and users to create new databases in database systems. It creates a database give it the name supplied in the Create Database statement.
Tip: Make sure you have admin privilege before creating any database. Once a database is created, you can check it in phpMyAdmin if you can access if or check in the list of databases with the following SQL command: SHOW DATABASES;
SQL does not allow developers to create the database with the existing database name. Suppose if you want to create another Student database in the same database system, then the Create Database statement will show the following error in the output:
If you want to replace the existing myFirstDB database, type the SQL statement below:
The DROP DATABASE statement is used to drop an existing SQL database. The SQL Drop Database statement removes an existing database from the database system permanently. If stored in the database, this statement deletes all views and tables, thus use caution when executing this query in SQL.
Database users and administrators may desire to change the database's name for technical reasons in some cases. As a result, the SQL Rename Database command is used to rename an existing database.