begin...end

The begin and end keywords enclose a series of statements so they are treated as a unit by control-of-flow constructs like if...else. A series of statements enclosed by begin and end is called a statement block.

The syntax of begin...end is:

begin 
          statement block
end

For example:

if (select avg(price) from titles) < $15 
begin 
   update titles 
   set price = price * 2 
 
   select title, price 
   from titles 
   where price > $28 
end

Without begin and end, the if condition applies only to the first Transact-SQL statement. The second statement executes independently of the first.

begin...end blocks can nest within other begin...end blocks.