The CREATE statement is the foundational Data Definition Language (DDL) command used to add new objects to a SQL database. By specifying an object type (TABLE, VIEW, DATABASE, SCHEMA, INDEX, PROCEDURE, FUNCTION, ROLE, etc.) and a unique name, CREATE permanently registers the object in the system catalog. Optional clauses like IF NOT EXISTS, OR REPLACE, and TEMPORARY control existence checks, replacement behavior, and session scope. Because CREATE changes metadata, most engines auto-commit the transaction before and after execution; rolling back is not always possible once the object is visible. Permissions are enforced: the issuing role must hold CREATE privilege at the appropriate scope (database, schema, or server). Some dialects extend CREATE with object-specific options (e.g., PostgreSQL PARTITION BY on tables or MySQL ENGINE).
OBJECT_TYPE
(keyword) - Type of object to create (TABLE, VIEW, DATABASE, INDEX, etc.)IF NOT EXISTS
(clause) - Prevents error if object already exists (supported by most modern engines)OR REPLACE
(clause) - Drops the existing object of the same name and recreates it (not in MySQL)object_name
(identifier) - Name of the object, optionally qualified by schemaobject_specific_definition
(varies) - Columns, constraints, query, or options depending on OBJECT_TYPEALTER, DROP, CREATE OR REPLACE, IF NOT EXISTS, DDL, SCHEMA, INDEX
SQL-86 (ANSI X3.135-1986)
CREATE can build tables, views, databases, schemas, sequences, indexes, functions, procedures, roles, and other objects supported by your database.
Include IF NOT EXISTS. The statement becomes idempotent and returns a harmless notice when the name is taken.
It is generally safe but will drop and recreate the view, which removes dependent grants in many systems. Re-grant permissions afterward.
DDL usually triggers an implicit commit in engines like MySQL and Oracle. PostgreSQL is transactional for most DDL, but many other systems are not. Assume CREATE cannot be rolled back unless your dialect explicitly supports transactional DDL.