This is very useful for application testing.
First you have to download the relevant sample databases from http://msftdbprodsamples.codeplex.com/releases/view/59211
Then copy the relevant AdventureWorks2008R2_Data.mdf file in to your machine where the MSSQL is installed. then go to MSSQL Editor and run the following query
CREATE DATABASE AdventureWorks2012 ON (FILENAME = 'D:\AdventureWorks2012_Data.mdf') FOR ATTACH_REBUILD_LOG ;
Don’t delete the above AdventureWorks2008R2_Data.mdf because this will be your database in MSSQL