I wasn’t planning writing this post, because there are tons of resources available on the internet, but since I want to create a comprehensive series of exercises, starting from the very basic, I understand most people interested on doing them, might have limited SQL Server knowledge.
AdventureWorks is one of the Microsoft sample databases ready for downloading here which can be installed on any SQL Server whose version is equal or superior to the version of the database, I mean if you download AdventureWorks2014 (current version) that can be installed in SQL Server 2014 onwards, not possible then in SQL 2012, 2008R2 and so on.
A free version of SQL Server is available for downloading here. It’s called Express Edition and as I said is free to anyone. Although I recommend, if you can, get a Developer Edition which contains all the features SQL Server has.
Once SQL Server is installed, (if you are not sure, just leave all defaults and click ‘Next’ till is done) you have to restore the AdventureWorks2014 database.
I recommend downloading the ‘Adventure Works 2014 Full Database Backup.zip‘ and place it in your server backup folder. You can check where this is in SQL Server Management Studio by right clicking your server name and then ‘Properties’. Go to ‘Database Settings’ to find all default paths.
Take notes of the three paths you have under ‘Database default locations’ because we’re going to need them later.
First extract the zip file in the backup folder and open a new query where you have to write the following RESTORE database statement.
RESTORE DATABASE [AdventureWorks2014] -- This path should be YOUR Backup default path FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQL2014\MSSQL\Backup\AdventureWorks2014.bak' -- This path should be YOUR Data default path WITH MOVE 'AdventureWorks2014_Data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQL2014\MSSQL\DATA\AdventureWorks2014_Data.mdf' -- This path should be YOUR Log default path , MOVE 'AdventureWorks2014_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQL2014\MSSQL\DATA\AdventureWorks2014_Log.ldf'
Once you execute this successfully, the database AdvntureWorks2014 should be available for you to start using it.