Creating Database and Table in the Microsoft SQL Server

Introduction

There are a number of articles available on databases. I have tried writing this article for beginners explaining how to create a database and tables in the Microsoft SQL Server (MSSQL) step by step and in simple language.

Database and DBMS

A database is an organized collection of data. It is the collection of schemas, tables, queries, reports, views and other objects.

As stated by wiki, A database management system (DBMS) is a computer software application that interacts with the user, other applications, and the database itself to capture and analyze data. A general-purpose DBMS is designed to allow the definition, creation, querying, update, and administration of databases. Well-known DBMSs include MySQL, PostgreSQL, Microsoft SQL Server, Oracle, Sybase, SAP HANA, and IBM DB2.

Now, we are going to use Microsoft SQL Server 2008 (MSSQL) for the backend; i.e., database.

Open the MSSQL 2008,

MSSQL

After clicking on the connect button the next window will appear.

connect

Now, we will see steps to create the database in the MSSQL.

create

Next dialogue box will open.

dialogue box

After clicking on the ‘Ok’ button the database will generate.

database

There are two methods to create the table.

  1. Using the SQL query
  2. Database Designer
First we will see the steps to create the table using the SQL Query,

Method 1

After clicking on the ‘New Query’ option the following window will open so we can write the query there. Now we will see steps to create the table.

New Query

We will see how to create the table.

table

The following window will show the created table.

created table

Now, we will see the steps to create the table using the database designer; i.e., Method 2.

Method 2

create

After selecting the ‘New table’ option the following window will open.

New table

Further steps are shown in the following window,

New table

Then table will display as follows,

 table