--- title: "CREATE DATABASE (Transact-SQL)" description: Create database syntax for SQL Server and all SQL Database Engine platforms. author: markingmyname ms.author: maghan ms.reviewer: wiassaf, dnethi, randolphwest ms.date: 02/06/2026 ms.service: sql ms.subservice: t-sql ms.topic: reference ms.custom: - references_regions f1_keywords: - "DATABASE_TSQL" - "DATABASE" - "CONTAINMENT_TSQL" - "CREATE DATABASE" - "CREATE_DATABASE_TSQL" - "CONTAINS_FILESTREAM_TSQL" - "CONTAINS FILESTREAM" - "CONTAINMENT" helpviewer_keywords: - "snapshots [SQL Server database snapshots], creating" - "databases [SQL Server], creating" - "model database [SQL Server], database creation" - "mounted drives [SQL Server]" - "CREATE DATABASE" - "CREATE DATABASE statement" - "file creation [SQL Server]" - "creating databases" - "containment" - "filegroups [SQL Server], database creation" - "database creation [SQL Server], CREATE DATABASE statement" - "moving databases" - "attaching databases [SQL Server], CREATE DATABASE...FOR ATTACH" dev_langs: - TSQL monikerRange: ">=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-current || =azuresqldb-mi-current || =azure-sqldw-latest || >=aps-pdw-2016" --- # CREATE DATABASE Creates a new database. Select one of the following tabs for the syntax, arguments, remarks, permissions, and examples for a particular SQL version with which you're working. [!INCLUDE [select-product](../includes/select-product.md)] ::: moniker range=">=sql-server-2016||>=sql-server-linux-2017" :::row::: :::column::: ***\* SQL Server \**** :::column-end::: :::column::: [SQL Database](create-database-transact-sql.md?view=azuresqldb-current&preserve-view=true) :::column-end::: :::column::: [SQL Managed Instance](create-database-transact-sql.md?view=azuresqldb-mi-current&preserve-view=true) :::column-end::: :::column::: [Azure Synapse
Analytics](create-database-transact-sql.md?view=azure-sqldw-latest&preserve-view=true) :::column-end::: :::column::: [Analytics Platform
System (PDW)](create-database-transact-sql.md?view=aps-pdw-2016&preserve-view=true) :::column-end::: :::row-end::: ## SQL Server ## Overview In SQL Server, this statement creates a new database and the files used and their filegroups. It can also be used to create a database snapshot, or attach database files to create a database from the detached files of another database. ## Syntax Create a database. For more information about the syntax conventions, see [Transact-SQL syntax conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md). ```syntaxsql CREATE DATABASE database_name [ CONTAINMENT = { NONE | PARTIAL } ] [ ON [ PRIMARY ] [ , ...n ] [ , [ , ...n ] ] [ LOG ON [ , ...n ] ] ] [ COLLATE collation_name ] [ WITH