Edurb 01 – Simple Database Create, Delete, and Rename in SSMS

Today’s brief lesson (edurb? blured?) is on database manipulation in SQL Server.  This functionality has largely remained the same over the past few versions of Microsoft SQL Server.  We won’t be going through immense detail as these should be short 5 to 10 minute lessons.

The pre-requisite to this lesson is that you have Microsoft SQL Server Express Installed.  My previous post guides you to two locations for directions on how to do this.

If you have installed SQL Server properly you should have this icon available to you.01   It is the Microsoft SQL Server Management Studio (SSMS) for your resume.  Open SSMS up.

02

There should only be one database engine set up on your PC with the SQL Server Express Install and your Windows Login should let your login with administrator (‘sa’) rights. Click on the Connect button.

03

Once connecting to the database engine has been completed you should have a window called “Object Explorer”.

We’re not going to go into detail about each section at this moment and skip to the databases.  The database node contains all the databases that are attached to the database server.  A database is just a logical collection of objects that hopefully are aligned to a specific purpose or functionality.  Click on the plus sign next to databases.

04

There are a few things of note here.  First, there is another folder here called “System Databases” as we are approaching this from the point of view of a neophyte – please don’t touch this.  The system needs to use information and depends on the contents of the databases located in this folder.  The second thing to note is that disk symbol next to names – these are the customer databases.  You will most likely not have any listed here at this particular moment from a fresh install of SQL Server Express.

Creating a database through the SSMS GUI

05

Right click on the Databases node and click on “New Database…”.

06

For now, as we are still learning the very basics we will fill in the only required field “Database name:”.  Later on we’ll be using an example on fuel economy so I’m naming the database FuelEconomy.  After you have typed in FuelEconomy press the OK button.

07

There you go!  You have done well.  We have created our first database.  That wasn’t so hard, was it.

Deleting a Database through SSMS GUI

08

To delete a database through SSMS (SQL Server Management Studio) simply right-click on the database you want to delete and then click on the “Delete” menu item.

09

The above dialog box appears after you clicked on delete from the previous menu.  If you are the only user of your database engine and this database specifically, you can just press the OK button and the database will be deleted.  If there is a chance that someone else might be logged in to the database (or you yourself have an open session you are unaware of) check the box “Close existing connections” and then click on OK.

Renaming a Database with SSMS GUI

10

Simply left-click on the database name that you want to change and overtype the name you want it to be.  Of course, if you are the only user of a database this isn’t a problem; however, if there are applications and other database users that could potentially be using the database it would not be recommended to change the database name.

And that’s the end of our first Edurb. 🙂  Have fun and be safe.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s