As I have already started some time ago with SQL Server, in this article I will present the way to write a if-else case in sql query. The database is available here, I have used a sample DB for one…