PostgreSQL 9.1
Version of implementation PostgreSQL of programming language SQLA version of PostgreSQL.
Examples:
Hello, World! - SQL (15):
select 'Hello, World!';
Factorial - SQL (447):
The task of factorials calculation is solved using standard methods only: a built-in factorial function !
(postfix form; there is also a prefix form !!
) and a set function generate_series
which generates a set of rows containing values between the first and the second parameters.
select n || '! = ' || (n!)
from generate_series(0,16) as seq(n);
Fibonacci numbers - SQL (448):
WITH RECURSIVE t(a,b) AS (
VALUES(1,1)
UNION ALL
SELECT b, a + b FROM t
WHERE b < 1000
)
SELECT array_to_string(array(SELECT a FROM t), ', ') || ', ...';
Comments
]]>blog comments powered by Disqus
]]>