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
- Obtain the Databases data files for the version of SQL server you have installed from the CodePlex website here.
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…
- Click the Add Button and navigate to and select the .mdf file (This is the database file you downloaded).
- 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.
- Finally, when you window looks like below simply click ok to attach the database.
- 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.
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.