It can do loops and recursion. It can use as much memory as it is allowed. It can do general programming via functions and stored procedures.
It can't do loops. Unless you're talking about extensions to SQL such as PL/SQL and T-SQL.
It can't do loops. Unless you're talking about extensions to SQL such as PL/SQL and T-SQL.