CREATE DATABASE

The SQL CREATE DATABASE Statement

CREATE DATABASE creates a new, empty database.

CREATE DATABASE databasename;

-- example
CREATE DATABASE shopdb;

Tip: After creating a database, list databases with SHOW DATABASES; (MySQL) or \l (PostgreSQL psql), and switch to it with USE shopdb; (MySQL / SQL Server) or \c shopdb (psql).

DROP DATABASE

DROP DATABASE databasename;

Note: Dropping a database deletes every table and all data in it. Make sure you have a backup first.

Schemas

Inside a database, tables are grouped into schemas (namespaces), such as dbo in SQL Server or public in PostgreSQL. In MySQL, "schema" and "database" mean the same thing.

CREATE SCHEMA sales;
CREATE TABLE sales.Invoices (InvoiceID INT PRIMARY KEY);