CREATE/ALTER DATABASE Statement
The ANSI standard does not actually contain a CREATE DATABASE statement. However, since it is nearly impossible to operate a SQL database without this command, we've added CREATE DATABASE here. Almost all database platforms support some version of this command.
Platform |
Command |
---|---|
DB2 |
Supported, with variations |
MySQL |
Supported, with variations |
Oracle |
Supported, with variations |
PostgreSQL |
Supported, with variations |
SQL Server |
Supported, with variations |
This command creates a new, blank database with a specific name. Most DBMS platforms require the user to possess administrator privileges in order to create a new database. Once the new database is created, you can populate it with database objects (such as tables, views, triggers, and so on) and populate the tables with data.
Depending on the platform, CREATE DATABASE may also create corresponding files on the filesystem that contain the data and metadata of the database.
Since CREATE DATABASE is not an ANSI command, it is prone to rather extreme variation in syntax between platforms.
The DB2 statement CREATE DATABASE initializes a new database with a variety of user-defined characteristics, such as collation and autoconfiguration options. In addition, the statement also creates the three initial tablespaces, system tables, and recovery logs required by a DB2 database:
CREATE {DATABASE | DB}database_name
[AT DBPARITIONNUM] [ONpath_and_drive ...
No credit card required