Create New Database in SQL-Server Management Studio 2008.

Create New Database in SQL-Server

In this post i will explain you how to create new database in sql server and how to manages database in server. before we going to start create database, let’s understand basic concept of database.

What is Database?

Database : The Database is a collection of information which is well  organized, so we can easily manipulate the information. Manipulation means we can insert, retrieve, update and  delete information easily.

In computer language a database is a collection of information in structured / tabled organized. The place where we can manage our database like create, update and delete, the place known as Database Server.

The Database server is a collection of database. We  can say database server provide place to store database. There are many database server available in market for store data in tabled manner.

Database is a place where we can store our data for permanent, and we can use and manipulate our data as per our need. For create and manage database we need database server, the database server known as database management system.

Here, we will learn how to operate and run microsoft sql server (mssql). we are using sql server management studio for create and manipulate database. we use sql server for stored data in tabled manner and use that data in future. For create and manage database, these are the basic step to manage database.

Create New Database in SQL Server Management Studio 2008

Step 1 – Open SQL Server Management Studio 2008

Step 2 – Connect Server with Server Name

Step 3 – Explore Server Name tab and select database option

Step 4 – Right click on database and Select New Database option

Step 5 – Write New database name at database name field

Step 6 – Click  OK to create database successfully.

Step 7 – Now we can manage database to create table and stored procedure in created database.

Check video tutorials of create new database in sql server management studio 2008

let’s understand how the all above step actually  work in sql server management studio in detail.

Step 1 – Open and Connect the SQL Server Management Studio 2008.

Open SQL Server Management Studio and connect the server using server name.

If Authentication mode set to Windows Authentication then we do  not need username and password for connect server, bu if the authentication mode set to SQL Server Authentication then we need username and password for  connect the sql server.

Here, we set Authentication mode to Windows authentication so we do not need username and password to connect server.

sql server management studio 2008

Open and Connect SQL Server Management Studio 2008.

 Step 2 – Create New Database in SQL Server Management Studio 2008.

After connecting server we are logged in the server, Now Select the server name and expand it  to  see more option. Select Database folder option to create new database.

The Database folder store the many database in it. Now, Right click on Database folder Select New Database option.

Connect Server –> Database –> Right Click  on Database –> New Database

Create New database in sql server management studio 2008.

Create New database in sql server management studio 2008.

In below screen, write new database name, here we create new database name = “TestExample” and click OK button to create new database in sql server.

Create New database in sql server management studio 2008.

Create New database in sql server management studio 2008.

Step 3 – Create New Table in Database

After creating new database, for managing our data or records we need to create a table in created database.

Click on the newly created database “TestExample”, there is a Table option in database. For creating new table right click on Table and select New Table option.

Database Name –> Table –> Right Click on Table Folder –> New Table

Create New Table in SQL Server Management Studio 2008.

Create New Table in SQL Server Management Studio 2008.

For creating table we assign column name with datatype and size. The table contain many columns with appropriate datatype and size. Here, we create three columns in Table, The column ID, Name and City. The ID column must be integer datatype and rest of two name and city columns  are varchar() or nvarchar() datatype.

Create New Table in SQL Server Management Studio 2008.

Create New Table in SQL Server Management Studio 2008.

Step 4 – Assign Primary Key on ID (unique column)

The Primary Key is a most important concept of sql server. We can set primary key on particular column of table.

The Primary Key is a not null and unique column of table. In our example the ID column  is a unique  and not null column, so we can assign primary key on ID column like below.

If you assign a primary key just right click on ID column select Set Primary Key option. The primary key column is unique and not null.

Assign Primary Key on column in sql table.

Assign Primary Key on column in sql table.

After assign primary key on ID column, now our ID column values unique and it must have some value we can not leave id column value as null. There is a other facility provided by sql server is Auto increment, if the ID column is Primary key then we set the ID column to Auto increment means the value of ID column is taken automatically in sequence manner.

For set auto increment property go to Identity Specification option of ID column and set Is Identity = yes.

Select Primary Key Column –> Identity Specification –> Is Identity = Yes

Set Auto Increment Primary key in sql server 2008

Set Auto Increment Primary key in sql server 2008

Step 5 – Save Table to sql server

After creating column in table save table with any text name as your like for table name. We save below table with name UserMst. The UserMst is out sql table name which is created in TestExample database.

Create New Table in SQL Server Management Studio 2008.

Create New Table in SQL Server Management Studio 2008.

Step 6 – Modify Columns in existing table

Now, after creating table in sql, some time we need to add some new columns in existing table, for adding or deleting column in existing table select Design option of table.

Right Click on Table –> Design

Modify columns in existing table in sql server 2008

Modify columns in existing table in sql server 2008

For see the records of table or open table select the Edit Top 200 Rows option.

Right Click on Table –> Edit Top 200 Rows — > View Table Data See the records of table right click on table and select Edit Top 200 Rows option to open table or see the records of table.

Create New database in sql server management studio 2008.

Create New database in sql server management studio 2008.

Here, we can see the table with some data information.

Create New Table in SQL Server Management Studio 2008.

Create New Table in SQL Server Management Studio 2008.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

7 + 6 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">