SQL Server IF…ELSE Statement T SQL (Part 16)

Опубликовано: 07 Сентябрь 2019
на канале: Syed Ali
328
81

SQL Server IF…ELSE Statement T-SQL Example:
Here we learn Why do you need Conditional Statements?
In real life, you perform many actions which are dependent on the outcome of some other activity or situation.
Some real-time examples are:
If it rains tomorrow, I will plan on a road trip.
If flight tickets are less than 3000 Rs. from my city, then I will go on vacation in Goa, else I will prefer some nearby tourist spot.
Here, you can see that one action, like Road trip above, is conditionally dependent on the outcome of another activity which is "whether it will rain or not tomorrow!"
Similarly, MS SQL also provides the capability to execute T-SQL statement conditionally.

-- SQL If Else Example

--Declaring Number and Total Variables
DECLARE @Marks INT = 72 ;

IF @marks greater than = 50
BEGIN
PRINT ' Congratulations ';
PRINT ' You pass the Examination ';
END
ELSE
BEGIN
PRINT ' You Failed ';
PRINT ' Better Luck Next Time ';
END


На этой странице сайта вы можете посмотреть видео онлайн SQL Server IF…ELSE Statement T SQL (Part 16) длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Syed Ali 07 Сентябрь 2019, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 328 раз и оно понравилось 81 зрителям. Приятного просмотра!