Last Updated : 15 Jul, 2025
Databases in Microsoft SQL Server are crucial for managing data, categorized into system databases, which are auto-created and user databases, created by users. In this article, We will learn about the basics of system and user databases along with methods for creating and managing them using T-SQL and SQL Server Management Studio (SSMS).
Create Database in SQL ServerDatabases are collections of objects like tables, views, stored procedures, functions, etc. In MS SQL Server, two sorts of databases are available.
System databases are created automatically once we install the MS SQL Server. Below is a list of system databases:
User databases are created by users (DBAs, and testers who have access to create databases). To create a database, the below methods could be used:
The following can be the basic syntax for creating a database in MS SQL Server.
Restoring a database using a T-SQL script can be done in SQL Server Management Studio (SSMS) by executing a series of SQL commands. Here are the steps to restore a database using T-SQL script:
Syntax:
Method 2: Using SQL Server Management Studio (SSMS)Create database <yourdatabasename>
Microsoft offers SQL Server Management Studio (SSMS) as a tool for managing SQL Server databases. You can use it to carry out a number of tasks, including managing security, writing and running SQL queries, and creating and modifying tables.
The following are some fundamental actions to use SQL Server Management Studio:
1. Start SQL Server Management Studio. The first time you run SSMS, the Connect to Server window opens. If it doesn't open, you can open it manually by selecting Object Explorer > Connect> Database Engine.
2. Right-click Databases, and then click New Database.
3. After filling in all fields, select Connect. You can also select Options to change additional connection options. Examples of connection options include the database to connect to, connection timeout value, network protocol, and so on. This article uses default values for all fields.
4. To verify that the SQL Server connection was successful, examine Object Explorer by expanding objects that display the server name, SQL Server version, and user name. These objects vary by server type.
5. To create the database with default values, click New Query.
Otherwise, continue with the following optional steps.
Query:
USE master
GO
IF NOT EXISTS (
SELECT name
FROM sys.databases
WHERE name = N'TutorialDB'
)
CREATE DATABASE [TutorialDB]
GO
6. Execute the query by selecting Execute or selecting F5 on your keyboard.
LimitationsEffective database management in MS SQL Server requires understanding both system and user databases. By using T-SQL scripts or SSMS, users can efficiently create and manage databases, adhering to best practices to ensure scalability and data integrity.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4