--SQL has evolved significantly. Most database providers 
--have extended SQL by wrapping it in it's own programming
--language. For example Oracle has the language PL/SQL
--SQL Server has T-SQL, etc.

--Fully featured programing languages offer features such as:
--1. Variables
/* Set my product type to 'Lanterns' */
declare @my_product_type char(120) = 'Lanterns'
--which store values that can be used in SQL over an over again
/* find the three most expensive products of my product type */
SELECT top 3 product,product_cost
FROM products
WHERE product_type = @my_product_type
ORDER BY product_cost desc

--2. Block structures to group multiple line of code together
BEGIN
	SELECT 1+2 as addition
	SELECT 1*2 as multiplication
	PRINT 'Done'
END

--3. Control Structures 
--such as IF statements 
declare @age int = 52
IF @age< 18 PRINT 'You are not old enough to enter this bar'
ELSE PRINT 'Welcome in.'

--and WHILE loops
declare @count int = 0
WHILE @count <=3 
	BEGIN
		PRINT @count
		SET @count = @count+1
	END

--And many other features such as handling exception, using cursors, etc
