Suppose we have only .mdf file and .ldf file is deleted or crashed then here is the solution for that:
For Example the database file name is AdventureWorksDW2012_Data.mdf
Here is the code:
GO
CREATE DATABASE [AdventureWorksDW2012] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2012_Data.mdf' )
FOR ATTACH
GO