Installing sample databases to get started in Microsoft SQL server

Posted in: Microsoft SQL Server, Technical Track

Anyone interested in getting started in SQL server will need some databases to work with/on. This article hopes to help the new and future DBA/Developer get started with a few databases.

There are several places to get sample databases, but one starting out in SQL server should go to the Microsoft sample databases. The reason for this is that there are thousands of Blogs/Tutorials on the internet that use these databases as the basis for the tutorial.

The below steps will detail how to get the sample databases and how to attach them to SQL server to start working with them.

This blog assumes you have a version of SQL server installed if not you can click here for a great tutorial

These 2 Databases are a great start to learning SQL Server from both a Transactional and Data Warehousing point of view.

  • Now that we have downloaded these 2 files we will need to attach them one at a time. First, open SQL Server and connect to your instance.
  • Expand the object explorer tree until you can right click on the folder called databases and then left click on Attach…

ObjectExplorer

  • Click the Add Button and navigate to and select the .mdf file (This is the database file you downloaded).

AtatchDatabase1

  • There is one step a lot of people getting started in SQL server often miss. As we have just attached a data file in order for SQL Server to bring the database online, it needs a log file which we don’t have. The trick to this is, if we remove the log file from the Attach Database window, SQL Server will automatically create a log file for us. To do this, simply select the log file and click remove.

LogRemove

  • Finally, when you window looks like below simply click ok to attach the database.

FinalAtatch

  • Repeat steps 3 to 6 for the second database file and any others you wish to attach.
  • The Databases are now online in SQL server and ready to be used.

FinalObjectTree

And that’s it! You now have an OLTP database and a DW database for BI.

Below are links to some good starting tutorials and some additional databases.

Databases

CodePlex

Stack Overflow

Tutorials

W3Schools

Enjoy!

email

Author

Want to talk with an expert? Schedule a call with our team to get the conversation started.

About the Author

Project Architect
Highly experienced and skilled Solution Architect with extensive systems expertise. My recent career has allowed me to develop an outstanding track record in assisting with the implementation of new business solutions and demonstrate a strong trouble shooting ability meaning fewer and less frequent issues for a large-scale network. I have excellent experience in end to end solutions from setting up infrastructure to designing Relational Databases and Datawarehouse Databases with the ability to report write across a wide range of software/technologies.

No comments

Leave a Reply

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