SQL Server – How to Create a SQL Database

Datacenter networking servers

SQL Server is Microsoft’s premier data platform. While its core is a relational database engine, it also includes many other subsystems and capabilities that go far beyond just a relational database. In this tutorial, I’ll explain how to create a database.

While not everyone realizes this at first, SQL Server provides business intelligence using Analysis Services, reports from Reporting Services, data integration using Integration Services, data validation with Master Data Services, business continuity using Azure and Availability Groups, and more. These are all of the features that businesses require from an enterprise data platform.

That said, the core of all of these services is relational data. SQL Server’s relational database engine runs on both Windows and Linux.

Understanding SQL Server databases

Databases are the primary containers for your relational database objects. SQL Server lets you create your own user databases, and some of the main relational database objects include tables, schema, indexes, views, logins, and roles. In addition, SQL Server provides a number of built-in system databases including the master, model, msdb and tempdb databases.

Creating a SQL Server database

SQL Server databases and database objects like tables can be created in a variety of ways. SQL Server Management Studio’s (SSMS) Object Explorer has a menu option that enables you to create a table interactively.

However, the most basic way to create databases and other database objects is by executing Transact-SQL (T-SQL) commands. T-SQL commands are text-based, and they’re usually executed using either the SSMS Query Editor or Azure Data Studio.

Create SQL databaseUsing the CREATE DATABASE command

Creating a SQL Server database using T-SQL command is pretty straightforward. You can do it by using the CREATE DATABASE command like the one below:


This T-SQL command created a database named myDatabase. As you might guess, you can specify the number of additional parameters.

Create SQL Database using the T-SQL CREATE DATABASE command
Create SQL Database using the T-SQL CREATE DATABASE command (Image credit: Petri/Michael Otey)


In this article, I detailed the basics of using databases, which are core components of the SQL Server relational database engine. Now you have created your first table, check out this article on Petri for using the SQL CREATE TABLE statement to add a table to your database.

Related Article