How to Take Database Offline and Bring it to online in SQL Server Database

Using T-SQL Command:

Take Database Offline:

ALTER DATABASE [Sales]

SET offline WITH ROLLBACK IMMEDIATE;

Bring Database Online:

GO

ALTER DATABASE [Sales] SET online;